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
parsing bug on function types in variant type definitions #11445
Comments
Accepting this (without parentheses around the function type) makes the following example ambiguous:
Is this |
So we need to change the grammar in the documentation because the current version has this ambiguity. |
My expectation would be:
This gives a justification for the interpretation This being said, in the case of |
I added your example as a test case. However accepting this input might be nice. There are two difficulties I can think of:
|
Why not declare the "of" syntax deprecated to keep only the more general syntax of GADT in the future ? OK it is a bit annoying to have to write the result type but a notation like type a_long_name_to_make_sure_we_know_what_it_means = Foo : (int -> int * int) -> _ could solve that problem for type which have no parameters but have a long name. |
No, we don't deprecate simpler, perfectly-fine syntax used all over the place (programs, docs, textbook, wikipedia, whatever) just to work around a parsing ambiguity. The cost of those deprecations is huge and in this case the benfit is razor thin. |
No, we don't deprecate simpler, perfectly-fine syntax used all over the place
(programs, docs, textbook, wikipedia, whatever) just to work around a parsing
ambiguity. The cost of those deprecations is huge and in this case the benfit
is razor thin.
First, I think that the "of" syntax is shorter but definitevely not simpler
when I teach. I actually teach directly GADT syntax nowdays, except for
constant constructors.
This suggested me a discussion that does not belong here, so I added
a topic in ocaml.discuss:
https://discuss.ocaml.org/t/simplification-of-ocaml-as-a-design-goal/10210
…--
Christophe Raffalli
tél: +689 87 23 11 48
web: http://raffalli.eu
|
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
I don't want to receive further notifications on this issue before we integrate @let-def's work on the parser. In the meantime I propose to close, after tagging with syntax-error-messages (which is morphing into "stuff that would benefit from Fred's work"). |
The following is rejected as a parse error, but it should be accepted:
The text was updated successfully, but these errors were encountered: