|
On May 3, 2014 7:00 AM, "Coroutines" <coroutines@gmail.com> wrote:
> 1) I'd like to see `a` (note the backticks) be a run-once form of
> string.byte('a') -- a single-character transform that happens at
> compile-time. When you use string.byte() in a loop it'll be run every
> time,
Hoisting initialization away from declaration would solve many problems when the real goal was to give a symbolic name to something.
for i = 1,1e9 do
static local string = string
static local byte_A = string.byte("A")
...
end
where "local" is probably optional. The semantics would be that an unnamed local is created at chunk toplevel but only comes into scope where it is declared.
The motivation for this was all the "local string=string local byte=string.byte local etc=etc" violations of "Don't Repeat Yourself."
This email message is an example of the violation of this principle; I'm sorta wondering how many details of this scheme I'm forgetting.