lua-users home
lua-l archive

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



Reuben Thomas wrote:
> 
> > So _VERSION is already there; it's set in the baselib.
> 
> I have two complaints about this: 1. It's not documented (AFAICS); 2. It
> should be available on a vanilla system; you shouldn't need to have a
> library included. (A minor quibble, perhaps?)

I agree with #1. I disagree with #2. If you're setting up a vanilla
system without baselib, you might not want to have even the _VERSION
global defined. (Perhaps you want to use it for some other purpose.)

In a vanilla system, tinsert wouldn't exist, anyway :-)

It is indeed in lbaselib.c, by the way; I checked. (It might have been
in lua.c, which is probably where I would have thought of putting it
myself... but baselib is probably better.)

I don't know what the plan for Lua and library loading might be, but my
libraries stash their name and version number in the _LIBS_LOADED
global, if it exists. I use that in my modified lua.c in order to tell
me what libraries I've included ... I find that less confusing
sometimes. The template creates the table _LIBS_LOADED just before the
init's of the libraries, and then printf's the keys and values after
they're loaded. Since I just did that for my own convenience, I didn't
bother modifying the standard libraries, but it would be easy enough to
do.

With respect to tinsert, I agree that it ought to use the third argument
rather than the last argument; that seems intuitive. (Although inserting
all of them would be cooler, and would not break any code which doesn't
assume that tinsert can handle cases of other than exactly three
arguments.)



> 
> > BTW, the tinsert bug appears to be present in 4.1alpha too.
> >
> > IMHO the bug is the calling convetion on tinsert itself.
> 
> Well no, at the moment it doesn't behave as described in the manual. That's
> a bug in the implementation.
> 
> > The statement
> >
> >   tinsert(x, foo())
> >
> > does completely different this when foo returns 1 or 2 results.
> 
> Plenty of functions do that; I don't have a problem with it.
> 
> --
> http://sc3d.org/rrt/ | computation, n.  automated pedantry