[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Empty? No. Array? No. Has? Yes.
- From: Tim Hill <drtimhill@...>
- Date: Fri, 5 Jul 2013 22:59:55 -0700
Cant say I disagree, but the same could be said of __tostring(), yet we have that. Of course two wrongs don't make a right, but I still think it's an asymmetry in the design.
On Jul 5, 2013, at 10:22 PM, Miles Bader <miles@gnu.org> wrote:
> Tim Hill <drtimhill@gmail.com> writes:
>> I suggested __type() as an extension to type() some time ago, for
>> other reasons. In fact, it's an odd omission (to my mind), given
>> that we have __tostring() and others.
>
> This has been extensively discussed on this list... one issue is that
> it's not entirely clear that "type()" is really a very good example to
> follow.
>
> I think typically when somebody queries the "type" of an object, what
> they _really_ want to know is "does this object conform to interface
> X" (e.g. a "table" allows lookups etc, a "function" can be called,
> etc), and it's not unusual for something to actually conform to
> _multiple_ interfaces (e.g. a table with __call)... So something that
> returns only a single value like type() can be awkward/clumsy.
>
> -miles
>
> --
> "... The revolution will be no re-run brothers; The revolution will be live."