lua-users home
lua-l archive

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


On 19/10/2011 01:06, Elias Hogstvedt wrote:
I personally don't think Lua should have this. A preprocessor doesn't suit Lua well, and
nor does define really due to how dynamic Lua is.

For the record, Lua 3 had a preprocessor, it was dropped in 4.

With textual includes comes a number of problems.
You might want to introduce tricks to avoid double includes, like
#ifnotdef _module_name_
#define _module_name_
#endif

It might be easier to do recursive includes.
Included files doesn't need to be syntactically correct!
I can imagine wonderful/awful tricks, like having a start of block comment at the end of an included file and the end at the start of another:

#include MyModuleCommentingOutRemainderOfCode

some(code)

#include EndOfMyModuleClosingComment

and so on.
I am not sure I want that... :-)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --