lua-users home
lua-l archive

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


Ge` 
The construct "local x <const>" is not valid syntax in previous versions of Lua (a "<" sign could not follow a variable name), so you don't break old programs with it. It's not the most elegant solution I have ever seen, but it does not break existing code. If you introduce a new keyword some programs will break.

I am not sure I understand.

If you run an old program in the new Lua 5.4 interpreter it should work. Is this what you mean?
If you run a new program with <const> on some old Lua 5.x interpreter of course it does not work.

So let's say we have decided to add the new keyword "const" (or something similar, it can be "local_const")
In the old program this new keyword is not used, therefore the old program will be able to run on the new Lua 5.4 interpreter.
And the new program will benefit from a cleaner syntax.

Let me know if my understanding is correct.

    Andrea 

--
Andrea Vitali