lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> I wrote:
> > I have to agree.  set/getglobal tag methods should be removed just like
> > foreachvar and all the other *global functions.  They are all just special
> > cases of the appropriate table functions.
> 
> set/getglobal tag methods act differently from gettable/settable methods.

Yes, I know.

> The later act based on the table tag, while the former act based on the
> value tag. With gettable/settable methods, we would have only one tag
> method for all globals: the method set for the table of globals. With
> set/getglobal tag methods, we can have different methods for different
> kinds of globals.

And this can be easily implemented using set/gettable on the global
array.  Btw, that's an additional difference: set/getglobal act an
all global-arrays, whereas set/gettable may be different for
different global tables.

> Most of our uses of tag methods for globals (detecting non-declared
> globals, tracing global assignments, detecting function redefinitions,
> etc.) set these methods for only one (or a few) tag.

Just say debugging ;)  IMHO, all _other_ uses are only obscure magic.

Ciao, ET.