[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: foreachi and artificial tables (and a library question)
- From: Ken Rawlings <krawling@...>
- Date: Sun, 8 Aug 1999 20:14:26 -0500 (EST)
> Why strange? May be because you're thinking about languages with declarations.
Sigh. No, not at all. I'm quite familiar with weakly typed languages
and, i'm sorry, but Lua is strange in this regard. What other scripting
languages allow references to uninitalized variables? I can name two
off the top of my head that don't: Scheme and Python. Python generates
a NameError, and Scheme gives a "variable not bound" error.
> What would you do with a variable with a value of nil that would be different
> for a variable that did not "exist"?
Easy. I'd be comfortable that when a conditional was evaluated that
all of the variable references in that conditional actually existed
and weren't a typo.
Yes, this can be fixed with tag methods, but that isn't really
effective since it breaks other people's code.
> No, but it surely will be part of the book on Lua that Roberto is writting.
> In the meantime, read lmathlib.c, which is the simplest library.
Great news about the book. I've looked at all the standard libraries,
but with sparse documentation on writing libraries and the standard
libraries being uncommented code(in how they're interacting with the
Lua interpreter) it's pretty frustrating.
Thanks,
_Ken