Re: [RFC] UString
| From: | Andrea Faulds | Date: | Thu, 23 Oct 2014 13:59:46 +0000 |
| Subject: | Re: [RFC] UString | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78275@lists.php.net to get a copy of this message | ||
> On 23 Oct 2014, at 14:53, Johannes Schlüter <johannes@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 :)
--
Andrea Faulds
http://ajf.me/