lua-users home
lua-l archive

Suggestion: arbitrary constant types

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


The type of constants in Lua can only be boolean, number, string now.
It looks good If it can support more types.
My suggestion is that if it assigns a global var to a const local var,
 the var is evaluated during the loading stage rather than running.
Idioms like :
local print <const> = print
function foobar()
 print "Hello World"
end
The local print can be a light C function constant. It can reduce the
memory footprint (fewer upvalues) and may faster. And it's more
friendly to the JIT or AOT compiler.
-- 
http://blog.codingnow.com

AltStyle によって変換されたページ (->オリジナル) /