lua-users home
lua-l archive

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



Currently, I am not sure constant folding is worth the trouble. We had
all kinds of problems with it: division and module by zero, NaN results,
problems with exotic lua_Number types (which may need a state to create
new values), etc. And it adds very little to the language: it is very
easy for the programmer to define suitable local "constants" to avoid
recomputing constant expressions, when needed.

Except for embedded systems where every constant with a name uses
up valuable RAM :-)

How much code is there related to constant folding?

At some point in the development of the Gems related to this topic,
it would be nice to get some ideas for building Lua for systems
where constants can be stored in ROM and the tables that store
them don't end up getting allocated in RAM when the library
is opened.

Sorry if the meaning is unclear, but I am playing with these
ideas right now and have not fully understood the issues...

Ralph