lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo <lhf <at> tecgraf.puc-rio.br> writes:

> This way works fine for both 5.1 and 5.2
> 
> There is no need for a module function and no need for syntax either.
> No one needs to know about _ENV for that only for complicated things
> like avoiding writing "M." (probably not a good idea as it serves as
> documentation of what is exported).
> 
> All my C modules follow this (but do create a global as well). Changing
> them to 5.2 is really easy, even removing the creation of the global.
> 
> I do not see any big deal here.

I completely agree with all of the above. 

I have written not-trivial (well, for me at least :P) libraries following this
mechanism and never ever had an issue with it. I agree that modules should not
pollute the global "namespace".

What is done is perfectly clear to everybody (newbies and seasoned developers
alike) and requires 1 extra single line versus the module approach. If a global
entry is wanted it's also very easy to add it as well from user side.