[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Empty? No. Array? No. Has? Yes.
- From: Miles Bader <miles@...>
- Date: Sat, 06 Jul 2013 14:22:31 +0900
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."