[ocaml-platform] Followup to Leo's proposal
Yaron Minsky
yminsky at janestreet.com
Thu Mar 14 10:46:17 GMT 2013
On Wed, Mar 13, 2013 at 11:39 AM, Alain Frisch <alain.frisch at lexifi.com> wrote:
> 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 :-)).
You're clearly right.
> 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.
I don't fully understand why you want N#M to refer only to compilation
units --- I suspect it's connected to implementation issues around
things like ocamldep --- but it's livable. In this case, as a
namespace author I would make sure that any auto-opened modules
contained no sub-modules, to avoid confusion on that point.
> 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).
y
More information about the Platform
mailing list