Import proposals (Discuss)
Tyro
Tyro_member at pathlink.com
Sun Jul 9 20:43:07 PDT 2006
In article <optcgd2ruo23k2f5 at nrage>, Regan Heath says...
>
>More random musings.. if we have a syntax that reads:
>
>import std.stdio as foo;
>
>which imports the symbols in std.stdio into a namespace called 'foo',
>preventing access as just "writefln" requiring "foo.writefln" then what
>happens in a case like this:
>
>--[a.d]--
>import std.stdio;
>template foo { writefln("Hello World"); }
>
>--[b.d]--
>import std.stdio as foo;
>
>void main() {
> mixin foo;
>}
>
>?
>
>Regan
Well, as far as I can see you should get an error telling you that foo is not a
template. Now if you meant for the first line in [b.d] to read:
import a as foo;
Then I think we have a different issue. But since the programmer when through
the trouble of importing into a named scope, this should be a no braner. In
order to access the foo template , he needs to code explicitly.
:--[b.d]--
:import a as foo;
:
:void main() {
: mixin foo; // Error, foo is not a template
: mixin foo.foo; // Ok
:}
Andrew
More information about the Digitalmars-d
mailing list