Re: Invokation on __toString() for object used as array key
| From: | Johannes Schlüter | Date: | Thu, 25 Sep 2014 10:59:42 +0000 |
| Subject: | Re: Invokation on __toString() for object used as array key | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77625@lists.php.net to get a copy of this message | ||
Hi,
On Thu, 2014-09-25 at 12:22 +0200, Florian Margaine wrote:
> Joe Watkins wrote (for fun) a new operator,
addressof. Code is
> here:
> https://github.com/krakjoe/php-src/compare/addressof
>
> I think it makes more sense than a new method on all objects. You could use
> it for any kind of value: scalar, resource, object. Building an array of
> sockets, for example, would be very easy with such an operator.
For one this leaks quite some implementation details to userland which
we shouldn't do aside from debugging features. Secondly this becomes
unintuitive with value objects (see my DateTime example in this thread)
johannes