[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [proposal] a new keyword : final
- From: "J.Jørgen von Bargen" <jjvb.primus@...>
- Date: Tue, 23 Mar 2010 17:56:14 +0100
François Perrad <francois.perrad <at> gadz.org> writes:
> The keyword 'final' is a specialization of the keyword 'local'.
> The goal is the defensive programming.
I'd like this very much and second this proposal.
> Only the parser is modified and produces new errors.
> The VM is not modified (The goal is not the performance optimization).
I believe, later on we could change this to constant propagation and
thus get some optimizations (still without changing the VM!)
Think of something like this
final DEBUG = true
function somefunc(somearg)
if DEBUG then
print("somefunc(",somearg,")")
end
local result=do_something(somearg)
if DEBUG then
print("do_something(",somearg,")=",result)
end
return result
end
A smart compiler could eliminate the debug code, when DEBUG is set to false