-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Move extensibility to use-site #240
Comments
Minor quibble: I find I like this a lot. It's a lot nicer than going around copy-pasting |
What about javsacript's spread syntax? Something like: Could be used in pattern matching too:
Me too! My gut reaction was wondering if this could be abused. In other words, is keeping it explicit per record protecting us from ourselves? But I don't think so. |
@blaix it sounds like you are talking's about two different things. |
Very likely! I'm easily confused. Happy to delete if I'm talking nonsense. |
If I'm understanding @blaix correctly, you'd be able to extend a record literal type like For records it works fine. For Custom Types/Tags, I guess it could work like I do like the idea of matching this up with pattern matching, but I think that's a discussion we can have on Zulip. |
Right, I think I focused too much on the |
Copying this idea from elm slack, by Changlin Li
[…] RE Roc, I agree I've been meaning to try it out. There's one small UX thing about composability that I wish Roc did differently (essentially I don't think that type synonyms themselves should express whether they are extensible, but the extensibility should be delayed to the call site, so that e.g. in hypothetical Elm syntax type MyRecord = {a : Int, b : String} could be used at the callsite as myFunctionWithExtensibleRecord :: a ++ MyRecord -> Int, which would also allow type synonyms to be nicely merged together (e.g. type MyBigRecord = MyRecord ++ MyOtherRecord) without needing to decide beforehand which type synonyms are meant to be extensible and which aren't, since that's usually practically ends up being more relevant for callsites
The text was updated successfully, but these errors were encountered: