lua-users home
lua-l archive

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


Coda Highland wrote:
> Can you write correct software without const locals? Of course you can.
> Is this a game-changing feature that's going to impact how everyone
> writes Lua code? No, it's not. You can still use Lua 5.4 without ever
> touching <const>. But since it's a feature that needed to be introduced
> to support <toclose>, there's no reason NOT to expose it to other uses
> as well, for the people who do want to make use of it.

I do see a reason not to expose it: to keep the core language as plain
as possible.

If constant variables are desired, I would wish for a language feature
specifically designed for them and not just some by-product of another
feature.

As Egor Skriptunoff already wrote in a separate thread, what would be
really useful would be constant global variables and table entries.

If I mess up a local variable the error would probably be rather local,
too. If I mess up a global variable (e.g. math.pi = 4) I create an error
in some random module.

So I got the impression that a new language feature is added just
because it appears to be "cheap" but in this case it reminds me of the
sentence "you've caught the kitten and let the cat escape".

Best regards,

David