Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006271OCamlOCaml generalpublic2013-12-14 12:142013-12-18 20:37
Reporteryallop 
Assigned To 
PrioritylowSeverityfeatureReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006271: 'let open' in class expressions
DescriptionIt'd be useful to have 'let open' available in class expressions:

   class c =
     let open M in
     object ... end
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0010715)
frisch (developer)
2013-12-16 10:36

Note that the following achieves the same effect:

include struct
  open M
  class c = object
    ...
  end
end
(0010743)
yallop (developer)
2013-12-18 00:46

Thanks, Alain! That's a useful workaround, and adequate for my use case.

There are a few other benefits in allowing 'let open' in class expressions. For one thing, there's a pleasing uniformity about having 'let open ... in' available everywhere that 'let ... in' is available. It also handles a few cases that the 'include' approach doesn't: for example, it supports recursive classes where you want careful control over the scope. Perhaps these aren't enough to justify its inclusion, though.
(0010745)
garrigue (manager)
2013-12-18 02:51

Well, "let open" should be simple enough to do, so I'll consider seriously doing it.
Note that on the other hand "let module" would be really difficult.
(0010751)
lpw25 (developer)
2013-12-18 20:37

On a related note, it might be nice to allow open statements within class definitions:

    class c = object
      open M
      ...
    end

- Issue History
Date Modified Username Field Change
2013-12-14 12:14 yallop New Issue
2013-12-16 10:36 frisch Note Added: 0010715
2013-12-18 00:46 yallop Note Added: 0010743
2013-12-18 02:51 garrigue Note Added: 0010745
2013-12-18 20:37 lpw25 Note Added: 0010751


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker