lua-users home
lua-l archive

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


const set1 = { _G }

Is an immutable table that has one non immutable entry, whatever it
is. Again, just because you have one immutable set, does not
automatically deepfreeze any of its contents.

Additionally there is a difference if you make a table immutable or if
you make a variable immtuable.
So to talk about the hypothetical syntax you use:

const set1 = { _G }

is something different than

set1 = const { _G }

Where the former is a variable that will always point to the table you
just created, while the second is an immutable table, but set1 might
be changed to point to something else instead.

I suppose you just didn't fully understand what you called "crazy by itself".

I wouldn't use the "const" keyword, however, but introduce a compact operator.