lua-users home
lua-l archive

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


Thijs Schreijer <thijs@thijsschreijer.nl> writes:
> Then I would rather have a single type() function and replace its
> number' return value with the new types. Big incompatibility but the
> new integer division operator already is. Incompatible but clean.

Predicates are actually _more_ clean, and yet aren't incompatible
("isnumber" and "isinteger"/"isfloat" can exist simultaneously).

If you are worried about function namespace pollution (I'm not,
particularly, but ...), it's also possible to use a predicate-style
solution with a separate type namespace, e.g. "istype(OBJ, TYPE)",
where TYPE is 'number', 'float', 'table', etc.

-miles

-- 
Rational, adj. Devoid of all delusions save those of observation, experience
and reflection.