Skip to content

Conversation

@non
Copy link
Contributor

@non non commented Oct 24, 2017

I still wanted to write more, but here's what I have at this moment.

@jvican I'm going to try to push some more change to this branch but feel free to merge what you want when you want.

I still wanted to write more, but here's what I have at this moment.
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these look very well thought out.

Do we have any example showing how we would use opaque types that have type bounds?


```scala
package object prob {
opaque type Probability = Double
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very nice example.

### Fix-point type

```scala
package object fixed {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@jvican jvican self-assigned this Oct 24, 2017
@jvican
Copy link
Member

jvican commented Oct 24, 2017

My updates: I had a read of http://cr.openjdk.java.net/~jrose/values/shady-values.html and I have nice observations to make on the differences between value types and opaque types. I'll follow up with a writeup of these!

@jvican
Copy link
Member

jvican commented Oct 24, 2017

We can wait and add updates in this PR before next SIP meeting (in November), or merge this right away and follow up in different PRs. What do you think it's best @non?

This adds some prose to each example, and adds the `Nullable` example.
@non
Copy link
Contributor Author

non commented Oct 24, 2017

I just added a Nullable example that uses AnyRef as a bound.

@jvican jvican merged commit 641dbba into scala:master Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants