diff --git a/_sips/sips/2014-06-27-42.type.md b/_sips/sips/2014-06-27-42.type.md index fcc021993f..4603974c37 100644 --- a/_sips/sips/2014-06-27-42.type.md +++ b/_sips/sips/2014-06-27-42.type.md @@ -575,7 +575,7 @@ applications which work with large datasets. ## Follow on work from this SIP Whilst the authors of this SIP believe that it stands on its own merits, we think that there are two -areas where follow on work is desirable. +areas where follow on work is desirable, and one area where another SIP might improve the implementation of SIP-23. ### Infix and prefix types @@ -606,6 +606,16 @@ valuable. A prototype of this syntax extension existed at an early stage in the development of Typelevel Scala but never matured. The possibility of useful literal types adds impetus. +### Opaque types + +In the reference implementation of SIP-23, the `ValueOf[A]` type is implemented as a value class. +This means that implicit evidence of `ValueOf[A]` will erase to `A` (the value associated with +the singleton types). This is desirable, but due to value class restrictions, ends up boxing +primitive types (such as `Int`). + +If we implemented `ValueOf[A]` as an opaque type instead of a value class, then this boxing +would be ellided, and the `valueOf[A]` method would be compiled to an identity function. + ## Related Scala issues resolved by the literal types implementation + [SI-1273](https://github.com/scala/bug/issues/1273) Singleton type has wrong bounds