[ocaml-platform] Followup to Leo's proposal
Alain Frisch
alain.frisch at lexifi.com
Wed Mar 13 15:39:53 GMT 2013
On 03/13/2013 01:56 PM, Yaron Minsky wrote:
> I would have thought it more natural for N#M
> to translate to "let open namespace N in M"
Well, "let open namespace N in M" does not force M to be found in
namespace N (except if we get a nice warning for unused namespace opens
and you turn it into an error :-)).
I was thinking that the "N#..." notation would not be allowed for
accessing "toplevel values" in namespace N (i.e. values in module
automatically opened in N). Same for types. By the way, note that "N #
x" is already a syntactically valid (but always ill-typed) expression.
To be coherent with that, we should similarly disallow N#M to refer to a
sub-module M of an automatically opened module. I'd strongly prefer,
even if automatic open is supported, that N#M can only refer to a
compilation unit M.
So I wouldn't find it shocking if "open namespace N" brought some more
values/types/modules in scope (by automatically opening some modules),
but those components could not be accessing simply with the N#...
notation (one would have to write something like N#Std.x).
Alain
More information about the Platform
mailing list