[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fragile Recursion?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 10 Apr 2012 08:09:35 -0300
> Since in Lua all functions are really anonymous, recursion seems to be fragile.
This has nothing to do with recursion. It's a consequence of dynamic binding.
Consider this:
function hello()
print"Hello world"
end
print=nil
hello() -- error!
Is there anything to be fixed in this code??
If you want to force static binding, you can do it with
do
local print=print
function hello()
print"Hello world"
end
end