I settled on:
Apple(23L)
Beware that values of these types can't be passed to varargs methods,
you get a runtime ClassCastException as the compiler thinks we have a
reference type (its not exactly one the AnyVal types).
I think specialization will also fail to work with these types.
I've got a patch to fix the first problem, but I'm not sure it would
be accepted into Scala. Value classes, which might make it into Scala
2.10, will provide an officially sanctioned way to do this without
resorting to, as we essentially do now, 1.asInstanceOf[Int with Tag]
-jason
> Could we re-use the @@ syntax here, and introduce something more like:I settled on:
>
> val appleCount = 23L.@@[Apple]
Apple(23L)
Beware that values of these types can't be passed to varargs methods,
you get a runtime ClassCastException as the compiler thinks we have a
reference type (its not exactly one the AnyVal types).
I think specialization will also fail to work with these types.
I've got a patch to fix the first problem, but I'm not sure it would
be accepted into Scala. Value classes, which might make it into Scala
2.10, will provide an officially sanctioned way to do this without
resorting to, as we essentially do now, 1.asInstanceOf[Int with Tag]
-jason
--
You received this message because you are subscribed to the Google Groups "scalaz" group.
To post to this group, send email to sca...@googlegroups.com.
To unsubscribe from this group, send email to scalaz+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scalaz?hl=en.