June 11, 2016 Trying to pass lambda to function gives strange error | ||||
---|---|---|---|---|
| ||||
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? |
June 11, 2016 Re: Trying to pass lambda to function gives strange error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Incognito | 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!
|
Copyright © 1999-2021 by the D Language Foundation