lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 01/07/2011 8.10, steve donovan wrote:
On Fri, Jul 1, 2011 at 7:16 AM, Lorenzo Donati
<lorenzodonatibz@interfree.it>  wrote:
What I wonder now is whether the possibility of delaying the evaluation of
an expression would be useful also in other contexts.

Well, we already have such a mechanism - function() return
delayed_fun(something) end. Some have felt that this feels over-wordy,
so that ends up in the 'short function form' discussion meme[1].

Irrespective of actual notation, a closure is relatively cheap -
laziness can't be had for free.


Yes, that's the usual approach. I don't care too much about it being too wordy, although I realize that in some contexts it may be an issue (short anon funcs, etc.).

I don't know very much the internals of Lua, so I cannot myself judge about it being cheap enough. Reading the objections that occasionally come up to that idiom, I got the feeling that people don't think it is so cheap (relatively speaking).

If it is (and so the subject of this thread would be moot indeed), then it may be worth, at least to avoid this recurrent complaint, discussing to some extent its inexpensiveness, so that one could be pointed at a specific thread whenever in the future the complaint is raised again (if this extensive discussion has already taken place, then sorry for the noise and please be so kind to give me a pointer).

Anything else requires major re-engineering, I suspect; how to
harmonize it with the rest of the language is probably the hardest
part.

steve d.

[1] things like |x| x^2 (GSL-shell and metalua) and \x(x^2) (LuaMacro)



-- Lorenzo