[ocaml-platform] Changes to my previous proposal for namespaces
Leo White
lpw25 at cam.ac.uk
Mon Mar 18 16:18:16 GMT 2013
> Just to be clear, do you agree with Gabriel's claim that that
>
> open namespace A
> open namespace B
>
> will open A#Pervasives and then open B#Pervasives?
Yes
> As to your larger point, I basically disagree that the possibility of
> shadowing implied by (1) is something to be avoided. Module opens
> behave this way, and within Jane Street we've used them extensively,
> using limited, purposeful shadowing, for a decade, and to good effect
> as far as I can tell.
Shadowing is fine if the order of definitions is well specified. For
example, module opens are clearly ordered by their position in the
source file.
The problem is with shadowing where the order between definitions is not
well specified.
It is useful to be able to specify a namespace across multiple
locations, for instance within two separate search path files. The
ordering between "automatically opened modules" specified across these
multiple locations will not be well specified (probably depending on the
workings of your build system). This makes shadowing much riskier.
> I basically don't see where your belief that automatically opened
> modules are semantically problematic and uncomposeable arises from.
> Certainly, my experience with packed modules argues in the other
> direction. Do you propose to delete the possibility of shadowing from
> the module language as well?
Modules are defined in a single location, and can only be composed using
"include" statements. These include statements have a clearly defined
ordering.
More information about the Platform
mailing list