5 ms·
Probably the best change in my opinion was resolving the arity limit for case classes: https://issues.scala-lang.org/browse/SI-7296 https://issues.scala-lang.or
by film42 13y ago
Probably the best change in my opinion was resolving the arity limit for case classes: https://issues.scala-lang.org/browse/SI-7296 https://issues.scala-lang.org/browse/SI-7296
I've bumped up against that limit pretty bad while trying to deserialize json. Shapeless did a lot to solve the problem, but I'm sure glad that limit has been removed.
- deleted 13y ago[deleted]
- neverminder 13y agoI wish the same was done for tuples, but it wasn't and it's unclear whether that's even in plans.
- joostdevries 13y agoShouldn't that go hand in hand? The generated unapply method will involve a tuple of same arity I believe.
- neverminder 13y agoAs the matter of fact I'm not sure now. I was looking for a confirmation that tuple limit is removed in Scala 2.11, but couldn't find it whereas statements that case class 22 parameter limit is removed are all over the place.
- gourlaysama 13y agoAbstractFunction, Function, Product and Tuple are all still limited to 22. Increasing the limit would create too much bytecode, and in the current design, lifting the limit is just impossible (without runtime code generation or custom classloader, etc.).
- film42 13y agoSo why did they choose to allow case classes to have arbitrary arity? Not that I'm complaining, I just don't understand the underworking of scala that well.
- frowaway001 13y agoThey just don't emit all the boilerplate which would require unlimited-arity Tuples/Functions/... for larger case classes.
- acjohnson55 13y agofilm42: I think it was driven by Slick and the need to accommodate database tables with more than 22 columns
- neverminder 13y agoIndeed, because the fallback is HList and when I have tables up to 200 columns it's killing the CPU and crashing Scala IDE up to the point where you just can't work with it.
- gourlaysama 13y agoFor that very reason, there is no generated unapply method for case classes with >22 parameters. This doesn't prevent pattern matching on the case class, because the patmat knows it is a case class and extracts the parameters directly, without calling unapply.
- DannoHung 13y agoI'm not sure I understand the situations where having a tuple of that arity is beneficial. Some sort of code generation thing, perhaps?
- soq_4 13y agoAnother really big change is the AnyRefMap class which provides a very fast mutable hashmap. There's also a specialized map for keys of type long.