Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78276 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95450 invoked from network); 23 Oct 2014 15:21:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2014 15:21:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:48929] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/E8-41150-30D19445 for ; Thu, 23 Oct 2014 11:21:40 -0400 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id 6851845C84; Thu, 23 Oct 2014 17:21:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on km31408.keymachine.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.2 X-Spam-HAM-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.34] (ppp-93-104-7-154.dynamic.mnet-online.de [93.104.7.154]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 7187B45C6E; Thu, 23 Oct 2014 17:21:49 +0200 (CEST) Message-ID: <1414077690.3228.12.camel@kuechenschabe> To: Andrea Faulds Cc: Joe Watkins , Dmitry Stogov , Stas Malyshev , Philip Hofstetter , PHP Internals Date: Thu, 23 Oct 2014 17:21:30 +0200 In-Reply-To: <87D717D5-273B-4A32-A3E5-83EBDFD314CB@ajf.me> References: <1413875212.2624.3.camel@localhost.localdomain> <54469840.3070708@sugarcrm.com> <1414051917.2624.35.camel@localhost.localdomain> <1414060726.2624.60.camel@localhost.localdomain> <1414072403.3228.3.camel@kuechenschabe> <87D717D5-273B-4A32-A3E5-83EBDFD314CB@ajf.me> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] UString From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Thu, 2014-10-23 at 14:59 +0100, Andrea Faulds wrote: > > On 23 Oct 2014, at 14:53, Johannes Schlüter 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..