lua-users home
lua-l archive

Re: do you use the pre-processor?

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


Large projects really need a way to include and exclude code at compile 
time. A _much_ cleaner solution would be to have a compiler that can 
optimize on preprocessor defined boolean tokens which are constant and not 
part of the chunks namespace. If the token is false then the compiler 
would optimize the chunk away.
Something like 
$define debugging true
function test(x)
 if debugging then
 if type(x) ~= 'table' then
 RuntimeError('x is not a table')
 end
 end
 print(x.name)
end
Having only one such token to set would cover 90% of the cases.
Russ

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