Import proposals (Discuss)

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Tue Jul 11 13:46:03 PDT 2006


Regan Heath wrote:
> On Mon, 10 Jul 2006 05:37:41 +0000 (UTC), Tyro <Tyro_member at pathlink.com> wrote:
>> In article <optcgh6iaa23k2f5 at nrage>, Regan Heath says...
>>>
>>> --[a.d]--
>>> import std.stdio;
>>> template foo { writefln("Hello World"); }
>>>
>>> --[b.d]--
>>> import std.stdio as bar;
>>> import a;
>>>
>>> void main() {
>>>   mixin foo;
>>> }
>>>
>>> I accidently called the template and import named scope the same thing.
>>>
>>> Regan
>>
>> In this case I assume that you are concerned with conflicts that may be
>> generated between both imports of std.stdio in [a.d] and [b.d].
> 
> Nope. In a.d you can call "writefln" but in b.d you must call
> "bar.writefln", plain old writefln will fail, right?
> So, what does this mean for mixins?

Are you referring to the existing functionality (sans implementation
bugs) or some specific proposal here. IMO Tyro is right and plain old
writefln definitely shouldn't fail here. It should only fail when
std.stdio has been imported privately in file a.d. But if import were
private by default, then the compiler would say 'b.d(5): undefined
identifier writefln'.

-- 
Jari-Matti



More information about the Digitalmars-d mailing list