Re: <const> everywhere
Eduard Qwerty <[email protected]> Wed, 22 Apr 2026 23:16:45 -0700 (PDT)
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
I think the best option is to add "const" keyword which means "local
<const>". (But that can be confusing, and... it turns out, you can add a
second tag using "const <tag>"? Sigh.)
среда, 15 апреля 2026 г. в 09:44:33 UTC+5, Martin Eden:
> Hello guys,
>
> I'm writing new code in Lua 5.5 and trying that new "<const>"
> attribute for declarations. In short
>
> local <const> a, b = 1, 2
>
> blocks writing to "a" and "b".
>
> And
>
> local a <const>, b = 1, 2
>
> blocks writing to "a".
>
>
> That "<const>" is spreading just like "local":
>
> local <const> MyModernFunction = function() end
>
> local <const> MyModernTable = {}
>
> For my case more than half use cases can be marked "<const>".
>
>
> Maybe we can have "<var>" to mark write-enabled locations and
> make "<const>" default?
>
> (Like my wish to have "local" attribute as default.)
>
> -- Martin
>
>
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/57130111-46aa-4ad0-8340-f0768e99d1ffn%40googlegroups.com.