Alternative Syntax for lambda-statements
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Falcon |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
(This is not exactly a bugreport, but merely a feature-request)
Currently, the Lambda statement looks like this:
someFunctio
while doSomethingWith
// ...
end
end)
At first expression, this is perfectly fine. The Lua Language uses a similar solution, however it has one major flaw: Instead of evaluating the anonymous function, an additional call (as '()') has to be appended:
someFunctio
while doSomethingWith
// ...
end
end(x))
I'm not sure if this is behaviour is intended like this, but it's not very obvious.
That's why i'd prefer an alternative syntax for lambda statements:
/*
* lambda might be a keyword
* note the '[]'
*/
someFunctio
while doSomethingWith
// ...
end
})
I believe that would make creating lambdas alot more obvious and behave more like in other languages.
Again, this is not exactly a bug, but a feature request.
Yes, it is intended exactly so.
Also, {p1...pn => statement...} is currently equivalent to function( p1...pn); statement...; end.
Moreover, I think you misunderstood what function (p1...pn); statement; end (p1...pn) does. It doesn't return your lambda; it executes it on the spot and returns its return value. So, the expression you are searching for is exactly the first one you posted.
Finally, we had a lambda keyword, and it was removed.