-
Notifications
You must be signed in to change notification settings - Fork 1k
Add SIP-23: Literal-based singleton types #346
8000 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
Conversation
+1 for SIP-42 :) |
You'd be SIP-23. Not 42. |
Thanks @heathermiller! Just to make sure: is it completely impossible to skip a few numbers and get 42 for this one? :) |
Thanks for writing this up, @folone! I'll have a look this week. Hopefully in the first half. |
Yes, this isn't for fun – this is a serious language improvement proposal. |
@heathermiller Those two things are not mutually exclusive in my world :) I get what you're saying though, sorry for being silly: sometimes I cannot help it. |
@adriaanm Thanks, looking forward to your comments! |
The index 42 comes from the fact that this feature was codenamed |
On Tue, Jul 1, 2014 at 9:32 AM, Eugene Burmako notifications@github.com
Let's keep SIP numbers serial. SIP-42 is cute, but no reason throw our
—
Martin Odersky |
Allright, fair enough. Let's keep 42.type though :) |
@xeno-by I'll make sure |
TBH, I reckon that 23 is a better magic number than 42 anyway ;-) Cheers, Miles On Tue, Jul 1, 2014 at 10:28 AM, George Leontiev notifications@github.com
Miles Sabin |
@heathermiller I went ahead and changed the number to SIP-23. Will wait for @adriaanm and/or @retronym to have a look at the document, address their review and then, after everyone thinks the document is good to go, will squash everything into one commit. |
Sounds good! Thanks a lot George :) |
10000
So, someone just told me that @adriaanm is going on vacation end of this month, and I should bother him really hard if I want this merged any time before mid fall :) |
Someone was right. Thanks for the ping. It's in my starred items/TODO list :) |
@adriaanm thank you! |
As you know, I like the SIP and I'll champion it. The main reason for my slow down is that I wanted to rethink our SIP process. I'd like to split it in two phases: accept the SIP as "a good idea" (votes by the community, potential veto by SIP committee), and then refine/flesh out the SIP (the champion on the SIP committee guides the process, decides on timeline,...). I haven't really read up on state of the art in our own SIP process, I must admit. We all agree the SIP is a great idea, but we need to flesh out things like interaction with type inference and erasure (need to specify the wide type of the literals). I also agree it should be adopted in 2.12 (or even 2.11 under -Xexperimental). I have some concerns with the implementation. I think we should distinguish Regarding the interaction with type inference, I think a <: Singleton bound should suffice. To get a hold of a type's value, I'd propose |
Agreed. Will look into the things you mentioned. By the way, what would |
https://github.com/scala/scala/blob/2.12.x/src/reflect/scala/reflect/internal/TreeGen.scala#L260 |
@adriaanm, RE: your points about the SIP process... I fully agree that the SIP process needs to be refined – it's simply too much to seem open to accepting changes to the language/libs without a more refined process to ensure that both the idea and the implementation are solid on all fronts. And I agree with this two-phase idea. Publishing the SIP on http://docs.scala-lang.org/sips (following discussion on the mailing lists etc) seems like the halfway marker through phase one. So, given that, would it make sense to pull just the SIP document in, so it's a bit more visible and discussable? |
Makes sense, polish can happen in another PR. I'll try to write something up for the docs site to explain the process before the end of the month. |
Sure, sounds good. ping @folone? Also, the writing of the SIP can be refined as implementation details etc are discussed, and the SIP can simply be marked as "Updated Marchtember eleventeenth, 2014" as refinements are made. Just one option. |
- Add @adriaanm as this SIP's champion - Mention that there is no commitment to definitely have it in - Add last update date
LGTM! |
Awesome, thanks guys :) |
Add SIP-23: Literal-based singleton types
@heathermiller @adriaanm You guys are super fast! I was just about to ping you. |
\o/ |
@adriaanm can you flesh out what you have in mind with |
It's a fix for SI-5103 which would make shapeless's singleton-type related macros go away, not singleton types for literals. The latter (ie. this SIP) will be useful (eg. for specifying shapeless record types in some cases) but the use case section is overselling it wrt shapeless. |
We're also missing singleton types for I've approximated symbol singleton types in shapeless by tagging Examples of use here where singleton-typed |
I hadn't fleshed it out more than that |
@adriaanm FYI, this is how it's done in shapeless: Witness/WitnessWith, some syntax and a few examples. |
Hi, we discussed this SIP in the SIP meeting last week. I have a few questions & suggestions to get this going again: feature interactionsThe sip is great with examples and motivation, but needs a bit more work in the feature interactions area (always the hardest part, but really important!)
misc
|
Also, note that |
|
I believe he's referring to LiteralType. |
Ah, right. Both As types they aren't new ... they're singleton types of particular values and have been represented in Scala's type system, albeit without syntax, for aeons. |
You can read "we're adding a type with new meaning" as "we're adding a type syntax with previously inexpressible meaning." |
Hello folks,
Looks like we've discussed all the details on the mailing lists (scala-language and scala-sips), and there seem to be a general agreement on what this feature has to look like. So I decided to be bold, and go ahead with porting the draft document to markdown, incorporating all the suggestions from mailing lists as well as comments from the document itself.
Just read through the SIP Submission Process document, and it looks like I've messed up some intermediate steps (for example I've posted to scala-language instead of scala-debates). Hope this is okay. Also not sure if I can have number 42 for this SIP. Hope this is okay too :)
Please let me know what you think.
/cc @xeno-by @retronym @adriaanm @paulp @odersky @milessabin @gkossakowski @heathermiller