[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Conceptual problem with module
- From: Diego Nehab <diego@...>
- Date: Mon, 24 Apr 2006 20:11:57 -0400 (EDT)
Hi,
There are two issues here. One is namespace polution. The
other is returning the namespace from require().
In most cases, require *will* return the namespace. Either
your package returns it directly, or it calls module()
(which sets the package.loaded table) and returns nil. In
either case, the namespace will be returned.
About the namespace problem, Mildred's solution does the
trick. If you don't want your module to polute the
namespace, set loaded[modname] to the namespace *before*
calling module().
Regards,
Diego.