You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6363 Reporter: mkehrt Assigned to:@lefessan Status: closed (set by @lefessan on 2014-04-06T09:15:30Z) Resolution: not a bug Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general)
Bug description
I've been writing a lot of Scala recently, and on returning to OCaml, there is one feature I miss a lot. This is the ability to locally open a module inside a non-toplevel scope. In OCaml this would manifest as an "open ... in" binding used as follows:
let f x =
...bindings...
open M in
...more bindings and expressions...
This would be particularly useful when using modules to manage the namespaces of record labels, as one could open the module containing the record labels in a function dealing with that record but allow the labels to be namespaced elsewhere. This could avoid the variable.ModuleName.fieldName syntax, which is fairly cumbersome.
The text was updated successfully, but these errors were encountered:
Both of these features are available.
They are described in the language extension part of the manual.
The syntax is respectively
let open M in
and
let module M = ... in
Original bug ID: 6363
Reporter: mkehrt
Assigned to: @lefessan
Status: closed (set by @lefessan on 2014-04-06T09:15:30Z)
Resolution: not a bug
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
I've been writing a lot of Scala recently, and on returning to OCaml, there is one feature I miss a lot. This is the ability to locally open a module inside a non-toplevel scope. In OCaml this would manifest as an "open ... in" binding used as follows:
let f x =
...bindings...
open M in
...more bindings and expressions...
This would be particularly useful when using modules to manage the namespaces of record labels, as one could open the module containing the record labels in a function dealing with that record but allow the labels to be namespaced elsewhere. This could avoid the variable.ModuleName.fieldName syntax, which is fairly cumbersome.
The text was updated successfully, but these errors were encountered: