lua-users home
lua-l archive

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


Since only local variables can have the close or const attributes, these attributes imply local and local becomes plain redundant. I would thus prefer completely omitting the local keyword, as is common for languages which distinguish const and var/let/mut. Of course this could still be combined to form const close or close const:

const my_const = 42
close my_file = io.open(filename)
const close my_const_file = io.open(other_filename)
This should not be ambiguous either, is more terse and consistent with how other languages tend to do it.

On 19.06.23 14:51, David Sicilia wrote:
I believe the <...> syntax is generally perceived as being noisy and not in line with Lua's otherwise pretty face... can we change it to this:

local my_var close = ...
local my_var const = ...

AFAICS that should not be syntactically ambiguous, and would be worth doing even if it requires breaking code that uses const/close as variable names.

Also keep in mind that, from a general readability point of view, syntax-highlighters would take care of communicating to the user that those are special keywords, no need for <>.

David