lua-users home
lua-l archive

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

"John Hind" <> writes:
> Still seems to me that a second return value from type() is by far the most
> straight forward solution to this. Anyone who does not like this can easily
> front it with a wrapper in Lua to do it however they wish.

I disagree, I think the current math.isinteger (with a possible
math.isfloat alternative) is better.

In general I think predicates are more useful than "type()" type
operators, because they avoid the need to partition the input space,
and correspond more exactly with what the user typically wants to
know:  does this objects have <interface/behavior X>.

So basically I think the existing interface in 5.3-work1 is fine, and
a good model to follow.


p.s. I _also_ think that a similar model (isfunction(), istable(),
etc) would be better for general Lua type inquiries than type(); see
various long past threads on this mailing list... :]

"An atheist doesn't have to be someone who thinks he has a proof that
there can't be a god.  He only has to be someone who believes that the
evidence on the God question is at a similar level to the evidence on
the werewolf question."  [John McCarthy]