lua-users home
lua-l archive

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

Hi Steve,

On 1/11/11 12:59 PM, steve donovan wrote:
It would be convenient to have an animal called 'nada', which behaves
like nil, except in a table context (Mark Hamburg has made such a
suggestion, but was shot down for trying to introduce a null/undefined
distinction from _javascript_).

Don't you think that's just getting too complicated?

You could kind of scale this up further with every next nesting of
abstraction, I think. E.g. A null, then an undefined, for other
application, where nil or nada should be preserved as values
expressing something else than controlling the behavior of the
next control structure or function. Eof, error ... I do like Erlang's
atoms, no question about that.

But it would not befit Lua I think, even where it obviously made
sense. --- A clean implementation of atoms, yes, by the way.

Yes, a __type metamethod would be nice (especially if it can work on
this level) but I imagine it would make type() more expensive.

The cost of one table look-up. Not worse / moew often than
__newindex is being checked for, I think.