[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Recursive require
- From: Reuben Thomas <rrt@...>
- Date: Tue, 21 Mar 2006 13:42:36 +0000 (GMT)
I'm just updating my stdlib package for Lua 5.1, and I find that
although I was already using Kepler's compat-5.1.lua, there's a
difference with the real thing in the behaviour of require: namely, Lua
5.1 complains when require loops (a requires b requires c requires a).
I can see ways of getting round this, e.g. setting package.loaded at the
top of a module, but how should I be doing this? (Answers suggesting
"get rid of your loops" will not be looked on kindly: a straightforward
grouping of functions into modules by functionality results in loops,
e.g. bind (from std.base, to partially bind a function) calls
list.concat, while the std.list calls lots of functions in base.)
compat-5.1.lua sets package.loaded["name"] before loading the module, so
loops are fine. (I do see the use of unwanted loop detection.)
--
http://rrt.sc3d.org/ | maximiste, n. pessimiste (Roux)