-
Notifications
You must be signed in to change notification settings - Fork 33
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
Type directed array disambiguation #46
Type directed array disambiguation #46
Conversation
There's some previous discussion under ocaml/ocaml#616, which included array literal disambiguation as part of a larger proposal that included various additional syntactic conveniences (e.g. allowing disambiguation for Regarding the current proposal: I'm in favour. The benefits are fairly limited, but it's forward-compatible with various more interesting things that we might want to do later (e.g. immutable arrays). |
Out of curiosity, I gave it a try: nojb/ocaml@c124bfa. Not sure if the approach is exactly right (comments welcome!), but worked well enough for an experiment:
|
@nojb would you want to open a PR with that implementation? Maybe we can just get this one in. Thanks for taking a stab! |
arrays](https://github.com/ocaml/ocaml/pull/13097), and I believe several people | ||
have expressed a desire for compiler support for uniform arrays (which do not | ||
participate in the float-array opimization). (This is just hearsay; I do not | ||
have a reference.) Yet only `array` has first-class syntax, available both for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reference on uniform arrays: #37 .
Yes, I will open a PR soon and it can be discussed there. Thanks. |
See ocaml/ocaml#13340. |
This has now been merged in the compiler. Do we close? Do we merge this? I don't know the protocol. |
We don't have a good protocol for RFCs, the value is in the discussions I think. Merging would make sense, as it keeps a track record of RFCs we have accepted (in practice, if not formally). |
This RFC proposes extending the existing constructor-based type-directed disambiguation mechanism to array literal syntax, in both expressions and patterns. Right now, it would serve only to give literal syntax to
floatarray
s, but other array constructs seem likely soon (such as immutable arrays or uniform arrays).