Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85328 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20662 invoked from network); 20 Mar 2015 20:46:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 20:46:49 -0000 Authentication-Results: pb1.pair.com header.from=jbafford@zort.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jbafford@zort.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zort.net designates 96.241.205.2 as permitted sender) X-PHP-List-Original-Sender: jbafford@zort.net X-Host-Fingerprint: 96.241.205.2 nova.zort.net Received: from [96.241.205.2] ([96.241.205.2:40138] helo=nova.zort.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/69-64120-8378C055 for ; Fri, 20 Mar 2015 15:46:49 -0500 Received: from [10.0.1.2] (pulsar.zort.net [96.241.205.6]) (authenticated bits=0) by nova.zort.net (8.14.5/8.14.5) with ESMTP id t2KKkgxm010761 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 20 Mar 2015 16:46:42 -0400 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Fri, 20 Mar 2015 16:46:42 -0400 Cc: Sean Coates , Rowan Collins , Leigh , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <550B5A81.1090706@gmail.com> <550B7189.4040608@gmail.com> <7486C296-7535-4633-AFE2-02E7BBC67BC5@gmail.com> <550C1176.9050307@gmail.com> <550C1AE4.8090607@gmail.com> <550C1EC3.8000106@gmail.com> <550C317E.8020508@gmail.com> <550C6422.6080009@gmail.com> <23A888B3-4493-4720-A275-D820F8E07F! 58@zort.net> <080AC5EA-978C-44F8-81EE-789A2CBEE15A@seancoates.com> To: Alex Bowers X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: jbafford@zort.net (John Bafford) On Mar 20, 2015, at 16:27, Alex Bowers wrote: > On 20 March 2015 at 20:10, Sean Coates wrote: >=20 >> That=92s no different than `@` being invalid because it=92s already = in use. >=20 >=20 > The syntax would be [*from:to], which would currently throw a parse = error > (since asterisk is required to be placed between two numbers), so this > would be different. >=20 > Alternatively, an underscore could be used >=20 > This would then look like [_from:to] >=20 > Also, another option would be to not use the square bracket syntax at = all, > and move towards angled brackets for positional indexing. >=20 > This would then be $array<1:2> to get items in positions 1 and 2. $array<1:2> could be confusing to parse (if not confusing to read) = because of ambiguity with the existing < and > operators. For example: $foo ? $bar<1:2> 3 is currently valid syntax, and means $foo ? ($bar < 1) : (2 > 3) So there is probably some complex nesting of ?: and <:> that is entirely = ambiguous. Not necessarily saying it can=92t be done, but I think we should = probably avoid syntax with a significant chance of causing mental parse = errors. -John