- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
An abbreviated list of AnyRef-specialization issues and proposed remedies
Tue, 2011-12-13, 18:01
1) Does it really make sense that @specialized with no arguments buys
you 9/10 of the available specializations, and if you want the tenth
you have to enumerate all ten possibilities? Can @specialized be
changed to mean you get all 10? People who are concerned about class
explosion already have to enumerate their interest; people who aren't
are not going to be damaged.
2) Say you don't mind shouting all ten from the rooftops, what's wrong
with this picture:
trait Bippy[@specialized(
scala.Char, scala.Boolean, scala.Byte,
scala.Short, scala.Int, scala.Long,
scala.Float, scala.Double, scala.Unit,
Predef.AnyRef) T] { }
One of these ducklings is not like the others. Can I move it into the
scala package?
3) This is the important one (to me anyway) because it'll be
impossible to change later, and it's wrong:
Bippy$mcB$sp.class
Bippy$mcC$sp.class
Bippy$mcD$sp.class
Bippy$mcF$sp.class
Bippy$mcI$sp.class
Bippy$mcJ$sp.class
Bippy$mcS$sp.class
Bippy$mcT$sp.class <---- We are not specializing on 'T', we are
specializing on 'L'
Bippy$mcV$sp.class
Bippy$mcZ$sp.class
Can I fix it? I will put in the necessary binary compatibility
preserving struts and cogs.
4) Can I add AnyRef in to Function1's specializations? (That's
assuming I can get it working - the compiler crashes trying to compile
Function1 if I add it.)
It's omission seems to be consistently surprising to people.
https://issues.scala-lang.org/browse/SI-5267
-jason