Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005386OCamlOCaml generalpublic2011-10-26 02:112013-08-31 12:44
Assigned To 
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product Version3.12.1 
Target VersionFixed in Version 
Summary0005386: allow expression-level module open in field-assignment syntax
DescriptionGiven the following module declaration:
  module M = struct
    type t = { foo : int }
    let t = { foo = 13 }

The following expression is accepted:

  let _ = M.(

but the following is syntactically invalid:

  let () = M.( <- 13;

It would be nice if it were accepted.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
garrigue (manager)
2011-10-26 03:56

What is wrong with M.( <- 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.
sweeks (reporter)
2011-10-26 04:14

Yes, I prefer to restrict the scope of the open as much as possible.
xleroy (administrator)
2011-12-20 09:07

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.

- Issue History
Date Modified Username Field Change
2011-10-26 02:11 sweeks New Issue
2011-10-26 03:56 garrigue Note Added: 0006185
2011-10-26 04:14 sweeks Note Added: 0006186
2011-12-20 09:07 xleroy Note Added: 0006395
2011-12-20 09:07 xleroy Severity minor => feature
2011-12-20 09:07 xleroy Status new => resolved
2011-12-20 09:07 xleroy Resolution open => won't fix
2013-08-31 12:44 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker