-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Item attributes are allowed on regular let bindings #6454
Comments
Comment author: @alainfrisch Wouldn't it be simpler to reject item attributes with an explicit check in the semantic action, rather than tweaking the grammar? |
Comment author: @lpw25 I considered that but, since the attributes don't carry location information, getting a good error message that way looked like more work than tweaking the grammar. |
Comment author: @alainfrisch With the attached patch: # let x = let g x = x [@@foo] in g 5;; ^^^^^^^^^^^^^^^ Error: Syntax error: @@-attribute not expected. I don't think that the less precise location is necessarily a bad thing. Do you agree? |
Comment author: @lpw25
In exchange for the simpler code it seems reasonable. I think it should be "item attribute" rather than "@@-attribute". |
Comment author: @alainfrisch Ok, I've adapted the wording and committed that to 4.02 (commit 14982). |
Comment author: clarus I was actually using this bug/feature to add attributes on inner lets :). What is the right syntax to do it now? By the way, this syntax still works with OCaml trunk, I do not know if it is expected. |
Comment author: @alainfrisch
let[@foo] x = ... in ... or: (let x = ... in ...)[@foo]
Yes, some recent changes on the 4.02 branch will be back-ported in batch on trunk when 4.02 is released. |
git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@14982 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Original bug ID: 6454
Reporter: @lpw25
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:28:10Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Monitored by: @hcarty
Bug description
Item attributes are allowed on non-item let bindings. For example:
the attached patch fixes this:
File attachments
The text was updated successfully, but these errors were encountered: