[dmd-beta] dmd 2.063 beta 3
Kenji Hara
k.hara.pg at gmail.com
Sun May 19 05:58:20 PDT 2013
This behavior is intended change.
>From 2.063, UFCS name lookup finds *most inner* imported name.
module test;
void map(alias func, T)(T){} // dummy
void main() {
import std.algorithm;
auto r = [1,2,3].map!(a=>a*2); // hit std.algorithm.map instead of
test.map
}
As already Walter says, the precedence is now changed as same as normal
name lookup rule.
Kenji Hara
2013/5/19 Andrej Mitrovic <andrej.mitrovich at gmail.com>
> On 5/18/13, Walter Bright <walter at digitalmars.com> wrote:
> > I don't agree. A base class's scope must override the top level module
> > scope.
> >
> > Also, a base class can always override what a derived class does. This is
> > not hijacking.
>
> Don't you see that this change in behavior is going to surprise a lot
> of people? It's intuitive to me that this is going to cause trouble
> down the road. A base class could be in another file, in another
> library, and if the library writer decides to introduce a scoped
> import, suddenly the user's code might end up calling the wrong
> function (if the type signatures are the same the user will have *no
> idea* what happened). This is the definition of function hijacking.
>
> If it is a feature, it is not properly documented, and I can't tell
> which pull request changed the behavior so I don't know whether to put
> it in the changelog or not.
>
> Kenji, maybe you know?
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20130519/36f3cf6e/attachment.html>
More information about the dmd-beta
mailing list