lua-users home
lua-l archive

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


Hi,

> What you could be saying is that modules should not export variables,
> only constans and functions. (Or, as Asko wrote, they should be
> read-only.) There are lots of people who aggree with that idea.

This is not really a problem with exported variables. It's a problem
with any context the library want's to keep, regardless of whether it is
exported directly, accessible through a method or not exported at all.

Without imposing some kind restriction on how library functions are
exported, I don't think there is a solution for this problem (maybe
having socket:connect(...) instead of socket.connect).  I am not
comfortable forcing libraries *not* to keep any context either.

Perhaps it's better to forget the lazy namespace instantiation,
unless you can come up with some way to do a deeper copy-on-write that
would copy through closures too (blergh).

Regards,
Diego.