On 16 December 2014 18:14:27 GMT, Stanislav Malyshev <smalys...@gmail.com> wrote: >Hi! > >> I was previously in favour of this, but it’d prevent actual indexing > >No, of course it won't - if we ever introduce indexing objects (which >probably will require rewrite of the HashTable, any takers?) it would >be >very easy to index any object that does not implement __hash without >any >BC problem, and convert all those implementing __hash to "return $this" >if desired. > >> by objects in future, and I can’t think of any use cases which >> aren’t better solved by explicitly converting to a string/integer. > >There's no implicit conversion, and explicit one is a) inacessible in >userspace for anything but string and b) annoying for the same reasons >for which __toString exists.
Explicit conversion is trivial, just call whatever method you like. Sure, you can't write (int)$obj, but $obj->toInt() is just as expressive. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php