Hi Lua lovers!
Here's an idea and i hope we can have some kind of lazyness in
Lua.
The proposed syntax and semantics follows:
1) Lazy variables are kind of local variables. Though, their
value is not calculated until it actually needed, after that
they start acting as usual local variables. So,
some_function() will not be called until you use the variable
l value:
lazy l =
some_function(arg1, arg2)-- some_function() not called yet
-- some_function() called and result is used, l starts to be
usual var
local l_twice = 2 * l
-- some_function() not called, previously calculated result
is used
local l_thrice = 3 * l