|
Then perhaps the issue would better be solved with new keywords rather than trying to add modifiers to “local”. For clarity, I would much prefer to write:
do
local a,b,c
autoclose e,f,g
const t = 2*math.pi
...
end
to declare what are essentially three very different sorts of local object, rather than denote (using that rather clumsy angle-bracket syntax) that they are all local variables with slightly different flavours.
As many have said, the idea of a “constant variable” is kind of weird. And if a to-be-closed variable is such a different sort of beast to a regular local variable that it needs different compile time opcodes, then it doesn’t seem weird to have
a unique keyword to declare it. In fact, it feels weird to use the same keyword “local” to declare them all, especially the idea of a “local constant variable”.
(The idea of “constant variables” sounds very strange indeed - as strange as saying that local variables that are initialised to a fixed value, as in the code “local flag = true”, should be called “variable constants” :-).
|