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

allow expression-level module open in field-assignment syntax #5386

Closed
vicuna opened this issue Oct 26, 2011 · 3 comments
Closed

allow expression-level module open in field-assignment syntax #5386

vicuna opened this issue Oct 26, 2011 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Oct 26, 2011

Original bug ID: 5386
Reporter: sweeks
Status: closed (set by @xavierleroy on 2013-08-31T10:44:01Z)
Resolution: won't fix
Priority: normal
Severity: feature
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)

Bug description

Given the following module declaration:
module M = struct
type t = { foo : int }
let t = { foo = 13 }
end

The following expression is accepted:

let _ = M.(t.foo)

but the following is syntactically invalid:

let () = M.(t.foo) <- 13;

It would be nice if it were accepted.

@vicuna
Copy link
Author

vicuna commented Oct 26, 2011

Comment author: @garrigue

What is wrong with M.(t.foo <- 13) ?

Are you concerned by putting the whole expression into scope?
I really think we need a warning for local open hiding local identifiers...
IIRC, Jun already has some code to do that, it would be a good idea
to include it.

@vicuna
Copy link
Author

vicuna commented Oct 26, 2011

Comment author: sweeks

Yes, I prefer to restrict the scope of the open as much as possible.

@vicuna
Copy link
Author

vicuna commented Dec 20, 2011

Comment author: @xavierleroy

OCaml has no notion of l-value expressions: "a.lbl <- b" is an AST node carrying "a" and "b" as subexpressions and "lbl" as node annotation. For this reason, a local open that would scope over "a" and "lbl" but not "b" simply doesn't fit the model and would need a special AST node + a special typing rule. It's not worth it, and I move to close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant