lua-users home
lua-l archive

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


> Lua *used* to be like that, in the early days, before it had anonymous
> functions. Now, *all* functions in Lua are anonymous: "function f...end" is
> simply sugar for "f=function...end". In other words, functions definitions
> are not special constructs, simply assigments. So, what you propose is no longer
> possible.

Well, it is, but it's ugly: you'd need letrec and simultaneous assignment:

f, g = function () ... g() ... end, function () ... f() ... end

would work if the assignments to f and g were scoped over the right hand
side. Of course, in normal assignments they're not, or writing

f = f + 1

would be tricky...

-- 
http://www.mupsych.org/rrt/
Fate is unmoved by hope; rather, what we hope for changes (Murasaki)