Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83397 invoked from network); 20 Mar 2015 18:16:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 18:16:41 -0000 Authentication-Results: pb1.pair.com header.from=vikhudec@yahoo.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=vikhudec@yahoo.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain yahoo.com designates 98.138.91.232 as permitted sender) X-PHP-List-Original-Sender: vikhudec@yahoo.com X-Host-Fingerprint: 98.138.91.232 nm10-vm5.bullet.mail.ne1.yahoo.com Received: from [98.138.91.232] ([98.138.91.232:39458] helo=nm10-vm5.bullet.mail.ne1.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/D2-64120-8046C055 for ; Fri, 20 Mar 2015 13:16:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1426875397; bh=pBhOUT19dwfFxXApRafKZl2LikBOU9ytGmNA/hWsBK0=; h=Date:From:To:CC:Subject:In-Reply-To:References:From:Subject; b=hdmesHllBDK2cJrJAiOyv2LWsvr1DYECqnqZgaQY19egbHZ7zy7wPScIpqRTREpqpJbxLtYrXo5mcK/KHywVC6TQbjBJ17Hj+IlcEhpmojE5jLR8wcL/NIQG0Qb0YcVoVEhLNmJUmy2ddsnGJLt9Fyvtk8Hq36DAJM/+uUiLmePngMDnuT01bvHaE50B/qg+EQwMSTjM3rxV0o2/4SG57ryO5YySKab7oVtwE2sXkSCRTtHr17OLjjndB2cQlLSDeZhmAwEbulIEbonHdDkbB/Jz66Pv+p6ayF2xQUZXzGUw+c8rpQ/CHkZIjLZDZ7XD0NMpgbPO4MHFHzeHKFsWNw== Received: from [98.138.100.112] by nm10.bullet.mail.ne1.yahoo.com with NNFMP; 20 Mar 2015 18:16:37 -0000 Received: from [46.228.39.72] by tm103.bullet.mail.ne1.yahoo.com with NNFMP; 20 Mar 2015 18:16:37 -0000 Received: from [127.0.0.1] by smtp109.mail.ir2.yahoo.com with NNFMP; 20 Mar 2015 18:16:37 -0000 X-Yahoo-Newman-Id: 196039.99104.bm@smtp109.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: e0g9OkwVM1kfkRsPprdcDTC28jm8GidE0biEd2.8NTYGRnL OpfoBQAZEyVxMUFG63jTOKFyZMpqWbhjyILXtP9mUJVxzAV4gUVA7i6LrhGx zFz5JTeYr.x2ze4CEa7ZeGsRzgc8oPVb2qU1LDfFQeKuvFyg8r7oDpFFl0nc IqYSmiBOWlUsNS7CdYbKEL2pE8WHJBh7_du7BTUHekxwRbrg1ATO_jdzhyyM 8Byuszvos2T3wdpxcDMydjEMvaKRtoLj4yOZh5W44eWiMB0yN7MrlCjOAVMt emChKNNusJ_TFjYe.74O43_MBP.xqPtuQUE5S9ahm8Q7udxF_grDsxdLqA1d 3ztt2ArmOE05CT3xY491kB8HpWZwg8feJMN6.meF3HDXuLPZJJQ3SG6hqNk5 zyNWt8plC3mNSIeCWSggPp17l8KEP.RkYEajHeEugnYNlKXgSMeRgfRHrZUy bjU2BsSATCZS8f16DPS4REwHZaKOtSiGHPV56mbkl0BYAkm_b.MDqRHenig- - X-Yahoo-SMTP: RwGK.6yswBDCDhnjbZq3y.OXT_Xz Date: Fri, 20 Mar 2015 18:16:36 +0000 X-Priority: 3 (Normal) Message-ID: <1858073635.20150320181636@yahoo.com> To: Alex Bowers CC: internals@lists.php.net In-Reply-To: References: <550B5A81.1090706@gmail.com> <550B7189.4040608@gmail.com> <7486C296-7535-4633-AFE2-02E7BBC67BC5@gmail.com> <550C1176.9050307@gmail.com> <550C1AE4.8090607@gmail.com> <550C1DEC.5060706@gmail.com> <15030741.20150320143622@yahoo.com> <114590901.20150320170242@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: vikhudec@yahoo.com (Vik Hudec) Alex, On Fri, 2015-03-20, at 17:19, Alex Bowers wrote: > When you say restrict to one each. Do you mean one for strings and one for > arrays? Yes, that's what I mean. I would propose square brackets for array offsets, and curly braces for strings. > If so I'd have to disagree with this, since having the same operation > available to both is less likely to give mistakes. Can you give an example > of an actual benefit for this? Since this would cause a backwards > incompatible change. I can't imagine many places if any use the curly > brackets for arrays or strings, but since it exists there may be people > using it. Changing the behaviour of this to only work for one of the two > options seems unnecessary in the name of making code slightly more > apparent on initial reading. But variable names and so on should be used > to help distinguish from array or strings anyway. Yes, I'm very conscious of the substantial BC break, which is why I would target PHP 8 (or even 9, following a deprecation cycle). I guess you and I disagree on the benefits of syntax that is more self-documenting. The vast majority of PHP developers don't use variable names to indicate data types; the only common convention I've seen is for arrays' names to be pluralized (ie. $items, $rows etc.), but this doesn't really help. Often when less- experienced developers come across code that uses subscript syntax on a variable, they typically assume that the variable is an array (since string offsets are so much less common), and in doing so, introduce bugs. If the use of curly-braces was mandatory for string offsets, then code like this couldn't be mistaken for anything else. Vik