|
Hi there,
I've read a few faq, stackoverflow, even cool stuff like
http://lua-users.org/wiki/ShortAnonymousFunctions
I'm new to LUA (which I'm sure this email/ideas will make obvious even without me disclosing so)
And I was wondering what is the thinking around adding some syntactic sugar around shorter lambdas that would still capture the right scope
something like
(y){return 42+x+y}
instead of
function(y) return 42+x+y end
and also something like
function foo(&x)
&x = 42
end
local y
foo(&y)
print(y) -- prints 42
where &y is replaced (in caller) by
function(res) y = res end
and &x is replaced in the callee body by
&x = 42 -> x(42)
(ie it works)
Thanks for your input or pointers to how to do that or why it's bad
(I am aware the standard ways to change caller state is pass a table in, or return multiple values; but neither of those work within expressions for instance)
--
MooreaTv