lua-users home
lua-l archive

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

> > So, then...why not go hog wild? If we've got two, let's
> shoot for one
> > 'false' value for each primitive type. nil, false, 0, "", and (for
> > consistency) {}.
> You are right. Empty table should be considered as well, for
> consistency.

As the {} denotes a table constructor, each time it is used it creates a new
table. This may:
a) impose implementation complications/run-time penalties as either each
table instance would have to carry an 'empty' flag with it or a check for
emptiness would have to be performed on each test;
b) create additional semantic inconsistencies as: {} ~= {} but '' == '',
false == false, nil == nil and 0 == 0.

I vote for keeping nil and false the way they are.

Marius Gheorghe