lua-users home
lua-l archive

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

Title: Grupo Hasar
Just another idea: if locals are pushed on the stack the moment they are declared, then skipping the declaration of x and the rest of the code until the end of the loop body will cause something-with-x to access the stack with a wrong index. Would that raise an error at runtime?


Alex Davies escribió:
I believe an error would be possible, and I believe would be easier to debug then an occasional attempt to "x" on a nil value. Changing where the locals are effectively declared would result in loadnils (in the output code) where they really aren't necessary.

I believe Roberto/the authors worry that adding a continue now may well make future modifications to the language that much harder. Still, I'd go for one.

- Alex

----- Original Message ----- From: Hugo Etchegoyen
To: Lua list
Sent: Tuesday, February 26, 2008 1:11 AM
Subject: Re: upcoming changes in Lua 5.2 [was Re: Location of a package]

I don't know the compiler details. Would it be too difficult to consider local declarations after a conditional or unconditional 'continue' an error? Or collect all local declarations (not initializations) at the beginning of a block? For example, treat the given example code as if it was:


Ing. Hugo Eduardo Etchegoyen
Gerente Dto. Software de Base

Compañía Hasar | Grupo Hasar
Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
Visítenos en:
Información legal y política de confidencialidad: