[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Suggestion: arbitrary constant types
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Sun, 25 Apr 2021 10:56:08 +0800
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