Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91052 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82700 invoked from network); 1 Feb 2016 22:08:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2016 22:08:43 -0000 Authentication-Results: pb1.pair.com header.from=bjorn.x.larsson@telia.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=bjorn.x.larsson@telia.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain telia.com from 81.236.60.155 cause and error) X-PHP-List-Original-Sender: bjorn.x.larsson@telia.com X-Host-Fingerprint: 81.236.60.155 v-smtpout2.han.skanova.net Received: from [81.236.60.155] ([81.236.60.155:59232] helo=v-smtpout2.han.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/6B-07168-967DFA65 for ; Mon, 01 Feb 2016 17:08:42 -0500 Received: from [192.168.7.7] ([195.198.188.252]) by cmsmtp with SMTP id QMeDaQRcgQIOwQMeEa4Alk; Mon, 01 Feb 2016 23:08:38 +0100 To: Stanislav Malyshev References: <56A3A01F.1020500@php.net> <56AE8735.4070901@gmail.com> <56AFC8CC.6040201@gmail.com> Cc: PHP internals X-Enigmail-Draft-Status: N1110 Message-ID: <56AFD76E.1000006@telia.com> Date: Mon, 1 Feb 2016 23:08:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56AFC8CC.6040201@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfC9xzqPCgr25EBDSlU4gJryMHPO28goQdUEU39kyqCI+Lw8mfYbhblNNXeZWJPEx5hwimLf/P5j5ErECJBxsI2JlSuRyuvtgi6+y53GXqMpDs+fqu/FV Q9gCUftWxCRYdOjJuFhlgoPChGuzzU2fojKjtW8jiUOKdE0dJ00n1iNLLnHIy/S6Kyvq3aYWMBJz8HCq7p/HdKCOo4jgXuxzHEGWnBlhrCsNIIssu/RhWcBM Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2016-02-01 kl. 22:06, skrev Stanislav Malyshev: > Hi! > >> I strongly disagree with this. $str[$offset] is well-recognized, >> generally understood syntax that does not require familiarity with >> language peculiarities. $str{$offset} might be clear to a Perl >> programmer, but to anyone else this is just guesswork, with a typo being >> a reasonable assumption. > > The problem is that while it is generally understood, it's generally > understood wrongly. $str[$offset] is not the same operation as > $array[$offset]. There are many subtle differences. So while at the > first sight it's similar, it leads to "understanding" that is only going > to harm one in the future, when it turns out you really had wrong idea. > I think it's much better to instill the right idea from the start, even > if it means one has to take a brief look in the manual. String offset is > *not* the same as array access. > >> We should be deprecating this alternative syntax instead of recommending >> its use. I was under the impression that we *were* already discouraging >> its use and it has already been temporarily deprecated. > > I think deprecating it was a mistake and give how much semantic load [] > carries - array access, array constructor, now there's proposal to make > it used in deconstructing too - adding string offset to it looks like > bad idea. Different things should use different syntax, as much as possible. > Yup, you do have a good point here. Regards //Björn Larsson