Trying to pass lambda to function gives strange error

Incognito via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 11 16:41:37 PDT 2016


On Saturday, 11 June 2016 at 22:58:00 UTC, Incognito wrote:
> function foo (double x, double y, bool function(bar) callback)
> is not callable using argument types
> (double, double, bool function() pure nothrow @nogc @safe 
> function(bar w) pure nothrow @nogc @safe)
>
> I've tried with passing a delegate.
>
> I am calling it like
>
> foo(0,0, (bar b) => { return true; });
>
> It seems the only difference is all those attributes?!?! Surely 
> I don't have to specify all that junk when creating a lambda?

Nevermind. The => is the problem. D should definitely give a 
better warning message than that!


More information about the Digitalmars-d-learn mailing list