lua-users home
lua-l archive

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


> I guess you only need the gc method. It tells you exactly what you want
> to know: When a reference is released.

   Unfortunately, that's not enough. It doesn't tell me when a reference
   is created. A node with no previous or next nodes should be deleted,
   unless there is an outstanding Lua reference to it. If I don't know
   which are referenced, I don't know which are safe to delete
   immediately and which need to wait for the gc tagmethod.

> >   why are there no setlocal/getlocal tags?
> Performance (mainly).

   Do you take a substatial performance hit, even if there is no 
   tagmethod associated? Most of the time setlocal/getlocal wouldn't
   be bound.

> The absence of external documentation tries to reflect this idea. You
> should only use those functions if you know where they are and how to
> get them if you need.

   I'd document them officially, for one reason: the standard libraries
   use luaxlib extensively. There's not a whole lot of documentation in
   general on writing Lua libraries, so a new Lua developer(like myself)
   will look at existing libraries to see examples. The obvious 
   libraries to look at to see how to do things correctly are the standard
   libraries.

> at their code (most of them are very simple). You can also ask if you
> need more help.

   Thanks. For the most part it's straightforward, but there are
   a few places where exactly how things work were unobvious to me,
   like the luaL_opt_ functions and the space and buffer functions.

> Maybe (maybe!) that was not a good design. Anyway, I don't see how we could 
> change that now, without creating a major incompatibility. We could create 
> a new boolean type, and make the conditionals in the language to accept 

   I think that's a reasonable solution to the problem, especially if
   combined with some sort of expression tagmethod that's called when
   "nil" is the expression result.

   Then the situation would be similar to the situation with referencing
   unassigned variables. The default behavior is worrisome, but it can be
   easily modified with a setglobal tagmethod.

_Ken