lua-users home
lua-l archive

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


On Fri, May 31, 2013 at 10:41 AM, Jay Carlson <nop@nop.com> wrote:
> On May 31, 2013, at 10:07 AM, Owen Shepherd wrote:
>
>> Leo Razoumov wrote:
>>>
>>> Isn't  require supposed to set  package.loaded[modname]  to some true
>>> value*before*  it executes the module chunk to prevent a possibility
>>> of an infinite recursion?
>
> There is no appropriate value for package.loaded to be set to until the package code has finished executing. If require set it to some placeholder
> value, it would just cause errors in other portions of the application.

Yes, it is a touch cookie. But one cannot ignore a possibility that
A->B->C->A  and here is a cycle. At least a loader should be able to
identify a cycle and report back an informative message rather than
"recursion depth exceeded".

--Leo--