Re: Attributes

"'Sewbacca' via lua-l" <[email protected]> Thu, 28 May 2026 11:26:27 +0200
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
Code is written for humans to be read and only incidently to be executed by a computer.

In my opinion if a language addition does serve neither the programmer nor the language execution performance it should be discarded.

That being said I've heard the <const> keyword does help for constant folding. If I want to write performant code I first try non idiomatic overhead free Lua code and second C code.
The const directive would probably serve little to no additional performance gain in the first case and none in the latter. Additionally you'll lose backwards compatibility, a tradeoff that doesn't make it worth for me to use this feature.

~ Sewbacca

28.05.2026 10:27:16 'Vadim' via lua-l <[email protected]>:

> The const keyword is an unambiguous directive for the compiler (or runtime VM) in 'your' dynamically typed language. The fact it serves as a hint for the programmer reading code, is a side-effect of the above and not its primary purpose.

-- 
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/a3e29bab-63fc-47dc-81ee-34565b7984af%40kolabnow.com.