WeakRef updated to support Tango, too
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Wed Mar 5 04:36:08 PST 2008
Tomas Lindquist Olsen wrote:
> Bill Baxter wrote:
>> Tomas Lindquist Olsen wrote:
>>> Minor issue, the 'string' alias should be private, or it may conflict
>>> with aliases made by the user.
>>
>> As far as I know, private aliases conflict just like public ones, not so?
>
> The problem is in the modules that import your weakref module. When the
> alias is public it becomes part of the global symbol table (of the
> importing module) and conflicts with ones own alias. If you make it
> private, imports will not see the alias and you thus wont cause
> conflicts. Hope that makes more sense.
>
Are you sure of that? I've tested it with DMD 2.011 and making an alias
private makes no difference: in either case it does not become part of
the "global symbols" of the importing module. It only becomes so if the
*import* is public, which is a different thing.
Or maybe I misunderstood your example?
Here's what I tried:
--- pfx.bar ---
module pfx.bar;
alias int thealias;
--- pack.foo ---
module pack.foo;
import pfx.bar;
--- pfx.bar2 ---
module pfx.bar2;
alias char thealias;
--- test ---
module test;
import pack.foo;
import pfx.bar2;
thealias al; // No conflicts, pfx.bar2.thealias is chosen
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list