Skip to content
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

BNF insufficient for S (3, 4) #5883

Closed
vicuna opened this Issue Jan 10, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

commented Jan 10, 2013

Original bug ID: 5883
Reporter: norm
Assigned to: @garrigue
Status: closed (set by @garrigue on 2013-01-17T03:12:31Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: Mac
OS: OS X
OS Version: 10.7.5
Version: 4.00.1
Fixed in version: 4.01.0+dev
Category: documentation
Related to: #7783

Bug description

The syntax does not seem to produce the expression “S (3, 4)” in the context of the declaration “type w = S of int * int”. The rule: expr ::= constr expr might suggest that expr could be a tuple, but then “let u = 4, 8 in S u” should be legal but ocaml 4.00.1 rejects it.

Additional information

For prettier text and soap box see:
http://cap-lore.com/Languages/ocaml/bugs/e.html

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 10, 2013

Comment author: @garrigue

Indeed, constructors have an arity, and you cannot apply them to tuples.
This is not a new behavior: this has been this way since caml-light, more than 20 years ago.
But you are right that the manual is not very explicit about that.

By the way, I think that the problem is not the production itself (which is about the parse,
which indeed accepts any expression there, but about the explanation, which should mention the fact that the number of parameters must match the arity of the constructor.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 17, 2013

Comment author: @garrigue

Fixed the manual at revision 13254.
(Did not change the BNF, just the explanation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.