On 11-05-12 10:39 AM, Rafael Avila de Espindola wrote:
The problem is that this breaks the proposed separate namespace for
modules. If we don't know what bar is, we can't look it up.
I like :: too.
I am fine with any disambiguation option, or just declaring that import
foo::bar is invalid if we find two bars.
Given the options I prefer a::b over a:b as well. Surveying IRC we also
had a vote from brson for ::, one from robarnold for :, and one from tjc
for initial-caps-as-module-namespace-indicator as in haskell. I think
the weight-o-votes favours ::.
It sounds like we're semi-converged on this design:
- We get 3 namespaces: types, modules and values.
- Module paths are separated by :: for similarity with
C++ (and Perl, PHP, Ruby)
- a.b in value context means a is a value
- a.b in type context is illegal
- a::b in type context means a is a module, b is a type
- a::b in value context means a is a module, b is a value
- import a::b imports all "b" bindings found in type, value or module
namespaces. we may modify this rule to permit selecting which of
the three you wish to import, but for now it seems harmless to
overload since all 3 referencing contexts are unambiguous.
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev