lua-users home
lua-l archive

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


On Thu, Oct 21, 2010 at 00:23, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Thu, Oct 21, 2010 at 6:40 AM, HyperHacker <hyperhacker@gmail.com> wrote:
>> I'd expect them to be loaded or at least fake it with metatables (load
>> space.vec3 when I first access it). If I load a module I expect that
>> all of its functionality - including that which may be in a sub-module
>> - is available.
>
> Ah, but there are always optional modules (maybe the submodules are
> rarely-used/big) so I would not expect this in general.
>
> However, I use fake loading with Penlight, so that the lazy way is to
> say require 'pl' and then the submodules become available when they
> are accessed.  This way, the user only loads what they need, without
> having to keep track of loading the individual packages, unless they
> are being careful (e.g. if writing a module) when the explicit way is
> available and recommended.
>
> steve d.
>
>

Large/rarely-used modules are why I suggested using metamethods to
only load the module when someone tries to use it. __index on 'space'
would do here.

-- 
Sent from my toaster.