lua-users home
lua-l archive

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


Monday, July 11, 2005, 11:29:32 AM, Roberto wrote:

>> > require"foo.bar" works as usual; but if "foo.bar" doesn't exist then try
>> > to require"foo" before failing.
>> 
>> Just out of curiosity, what's wrong with Javier's proposal? It seems
>> pretty simple and feasible to me.

> Among other problems you mix two things - hierarchies and fail recover.
> For instance, if foo.bar fails because the file isn't there, foo may yet
> succeed. So require "foo.bar" succeeds without loading foo.bar...

Surely the intent was this:

1. try to load "foo.bar"
2. return if successful, but if "foo.bar" doesn't exist then try
3. require "foo" [i.e., recurse]
4. try to load "foo.bar" again
5. fail if "foo.bar" is not loaded

This recursion is limited by the length of pathnames.

e