Skip to content

Add mention of opaque types #974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion _sips/sips/2014-06-27-42.type.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down