UCFS does not work for nested functions?

aliak something at something.com
Mon Jun 18 18:58:53 UTC 2018


On Monday, 18 June 2018 at 17:58:11 UTC, Steven Schveighoffer 
wrote:
> What then can happen is that your local calls can get hijacked 
> from outside the module, if someone happens to define something 
> later that you happened to import. D tries to avoid such 
> possibilities.
>
> There's not much precedent for local symbols being overridden 
> by module-level symbols.
>
> -Steve

I thought that happens already with non-nested functions:

module a;

struct A {
   void f(); // assume it's added later
}

module b;
import a;

void f(A) { }
void g() {
   auto x = A();
   a.f(); // this would be calling local f until someone added A.f
}

Or I misunderstood what you said?

Cheers,
- Ali

PS: This is something I've worried about before actually [1] when 
I was more of a noob than now, but I've come to accept I guess :) 
... though I could still be misunderstanding things of course :/

https://forum.dlang.org/post/crcbaautgmrglhzvxmvk@forum.dlang.org



More information about the Digitalmars-d-learn mailing list