Package permission and symbol resolution

Manu via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 22 04:29:17 PDT 2014


On 22 April 2014 21:00, Manu <turkeyman at gmail.com> wrote:
> On 22 April 2014 19:16, John Colvin via Digitalmars-d
>> The rest of your problems are, I think, explained here:
>> http://dlang.org/hijack.html
>
> Ah ha!
> "in order to overload functions from multiple modules together, an
> alias statement is used to merge the overloads"
>
> I've actually read this article before, but I forgot that detail.
> Cheers mate! :)

Well, it worked in some cases...

How's this for a great error:
  Error: fuji.c.MFDebug.MFDebug_Warn at
D:\WinDev\fuji\dist\include\d2\fuji\c\MFDebug.d(38) conflicts with
fuji.c.MFDebug.MFDebug_Warn at
D:\WinDev\fuji\dist\include\d2\fuji\c\MFDebug.d(38)

Precisely the same symbol in precisely the same file are apparently in
conflict...
It seems it all gets confused when a file is imported via multiple
indirect means.

For instance:

B public imports A, B overloads some function in A and must make it
explicit using the rule you lank me to: alias finc = A.func;
If some client imports B, it is now working as expected; the overload
in A and B are both accessible.

But let's say there is also C which public imports A. C does not
overload anything A, so there's no need for the alias trick.

Client imports B and C (but not A). It seems that now A via C is in
conflict with A via B, even though B provides the alias to explicitly
satisfy the anti-hijacking rule. The same function reachable via C
stimulates the anti-hijacking error again even though it was addressed
in B where the overload was specified.


More information about the Digitalmars-d mailing list