[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: changes in 'require'
- From: Mark Hamburg <mhamburg@...>
- Date: Mon, 11 Jul 2005 10:09:01 -0700
The package system on our project (which was implemented before the 5.1
system became available) deals with this problem by having manifests as part
of the packages. The manifests map package names to the script to run or the
native code to run. This doesn't work for single file distributions, but
it's easy to put the manifest and the related elements in a single
directory. We don't really have hierarchical packages in this scheme, but
one is free to use whatever format one would like for package names so it
can look hierarchical if that's desirable.
The manifests are, of course, Lua files.
The downside to this approach is that one needs to read all of the manifests
before one can load anything.
Mark
on 7/10/05 3:55 PM, Roberto Ierusalimschy at roberto@inf.puc-rio.br wrote:
>> If require "foo.bar" fails, we would try loading "foo.meta" and then
>> retry "foo.bar", and then "meta" and retry "foo.bar". (I.e., we look for
>> meta packages backward in the chain, until we find one tha satisfies our
>> dependency).
>
> A simpler idea is to follow E.T. Before loading any module "a.b"
> we always *try* to load "a.meta" (or a.core or any fixed name like
> that). Then we load "a.b". It is simpler because we do not need to
> retry, and it also solves the problem of those that prefer the IPL
> approach (just make "a.meta" to load "a"). Less policy, more
> flexibility.
>
> -- Roberto