This page is no longer maintained — Please continue to the home page at www.scala-lang.org

22 fields limit in case classes

No replies
malsmith
Joined: 2011-06-09,
User offline. Last seen 1 year 21 weeks ago.

This limitation was discussed here http://www.scala-lang.org/node/7910
back in 10/15/2010 and was also raised and closed-duplicate here
https://issues.scala-lang.org/browse/SI-3656

Respectfully, I'm hoping to re-start a discussion because both the
thread and the bug seem to me to have drifted from the main point --
how about a higher limit.

Case classes are really useful and various projects (SQueryL, Lift
JSON, Play Framework) as well as several surprising roadblocks in our
projects at our company (typically in Data-Transfer-Objects or JSON
serialization). This has been made even more tantalizing with the
named parameter and default value features.

We want the full benefits of a case class - hash, equals and
extraction, pattern match without the limit number of parameters.

I think the simple point is - what would happen if the limit was
raised to 1024 or some other big number so that the limit would not
impact hardly anyone's work? If not 1024 how about 128 or 256. What
number greater than 22 and less than a bigger value would not present
a real problem.

Plenty of other compilers and tools have arbitrary limits - by itself,
having a limit isn't the issue, it's having a limit that is so low
that many people run into it.

I'm afraid that the low limit also leaves some people with the
impression that a language as elegant and robust as Scala is - is
somehow limited in an important area that is commonly applied in
frameworks and real applications. Scala should not leave anyone with
the impression that it is "limited".

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland