On Thu, 2014-10-23 at 14:59 +0100, Andrea Faulds wrote: > > On 23 Oct 2014, at 14:53, Johannes Schlüter <johan...@schlueters.de> wrote: > > > >> On Thu, 2014-10-23 at 11:38 +0100, Joe Watkins wrote: > >> It doesn't solve the problem directly but allows the programmer to solve > >> it for themselves, just like Object.hashCode in Java. > > > > The point is that it won't work in this way: > > > > $a = [ $ustring => $value ]; > > foreach ($a as $key => $v) { > > $key->ustring_method(); > > } > > > > but one needs something along the lines of > > > > $a = [ $ustring => $value ]; > > foreach ($a as $key => $v) { > > Utring::fromHashCode($key)->ustring_method(); > > } > > > > which likely looses object identity. > > > > It works but is not really nice :-) > > u($key)->split(',')->... works :)
While that's something else from the original example and makes this behave not like an integral part of the language. The proper solution would be a unicode type, but PHP 6 showed that this is not going to work out and this is way better than what we have right now, though and a good step in the right direction. We probably might integrate it in the core language more and more. My point is to stress that this is incomplete, as Dmitry said, and that we should not take this alone as the final solution forever. johannes P.S. u() is a bad name, will break lots of code, i.e. https://code.openhub.net/file?fid=wRj6MYm-GPDxPidisWYoLa23wFc&cid=CCYlIMOwTks&s=fndef%3Au&pp=0&fl=PHP&ff=1&filterChecked=true&fp=126888&mp,=1&ml=1&me=1&md=1&projSelected=true#L0 will give "weird" runtime behavior as their definition is guarded by a function_exists check but both functions do completely different things.. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php