Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006271OCamllanguage featurespublic2013-12-14 12:142017-05-09 16:25
Assigned To 
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
has duplicate 0007477closedyallop Allow "let module", "let exception" and "let open" in class 
has duplicate 0007529acknowledgedfrisch Class definition syntax restrictions 

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

Note that the following achieves the same effect:

include struct
  open M
  class c = object
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.
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.
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

- 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
2014-07-16 14:49 doligez Status new => acknowledged
2017-02-09 12:06 yallop Relationship added has duplicate 0007477
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-01 15:39 doligez Category -OCaml general => language features
2017-05-09 16:25 yallop Relationship added has duplicate 0007529

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker