How to use map?
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 11 07:53:35 PST 2014
On Tuesday, 11 November 2014 at 14:09:43 UTC, Lemonfiend wrote:
> Oh, no it doesn't. My bad.
>
> It was all about !(Foo) vs !(`Foo(a)`). Is there somewhere I
> can read more about this?
Don't know whether it's documented, but it's a consequence of
using string mixins.
unaryFun (which is used internally by map) is implemented this
way:
auto unaryFun(ElementType)(auto ref ElementType __a)
{
mixin("alias " ~ parmName ~ " = __a ;");
return mixin(fun);
}
where `fun` is `Foo(a)`. Of course, `Foo` is not visible in
std.functional. When you pass in a symbol, the lookup work
because it takes place at the point of instantiation.
More information about the Digitalmars-d-learn
mailing list