[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua-l Digest, Vol 36, Issue 69
- From: Tim Hill <drtimhill@...>
- Date: Wed, 24 Jul 2013 15:03:17 -0700
On Jul 24, 2013, at 3:35 AM, John Hind <firstname.lastname@example.org> wrote:
> Rather than introduce a whole raft of predicates implemented in one of the
> standard 'C' libraries, why not just extend type as suggested before:
> type, subtype = type(x)
> Which maintains compatibility except in very exotic cases, and ship an
> additional optional library implemented in Lua which provides the
> isinteger = function(x)
> local t, s = type(x)
> return (t == "number") and (s == "integer")
> and so on for every desired type predicate ...
Because there are subtle differences even in this case:
Suddenly gets an extra argument, which can break existing code. In addition, predicates are subtle when you have object models with various different inheritance rules and "isa" "hasa" issues.