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

An abbreviated list of AnyRef-specialization issues and proposed remedies

1 reply
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

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.)

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: An abbreviated list of AnyRef-specialization issues and pro
On Wed, Dec 14, 2011 at 3:01 AM, Paul Phillips <paulp [at] improving [dot] org> wrote:
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.

It's omission seems to be consistently surprising to people. 

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.)

https://issues.scala-lang.org/browse/SI-5267
-jason 

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