Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-5009

unadvertised change to case class weight due to copy method

    Details

      Description

      In scala 2.7, this class had one field. In scala 2.8 and beyond, it has three.

      case class A(x: String)(y: String, z: String) { }
      

      I'm pretty sure that using parameter lists beyond the first has been an advertised way of avoiding field creation for case class parameters. This was undone, since the copy method references all the parameters in all the lists and so fields are created.

      You can somewhat distastefully get around this by inhibiting the creation of the copy method.

      case class A(x: String)(y: String, z: String) {
        private def copy = "no fields for y and z"
      }
      

      This business should at least be documented.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rytz Lukas Rytz
                Reporter:
                extempore Paul Phillips
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: