Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 113 invoked from network); 20 Mar 2015 13:40:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 13:40:47 -0000 Authentication-Results: pb1.pair.com header.from=bowersbros@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bowersbros@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: bowersbros@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:36056] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/B2-21731-F532C055 for ; Fri, 20 Mar 2015 08:40:47 -0500 Received: by wgra20 with SMTP id a20so89665135wgr.3 for ; Fri, 20 Mar 2015 06:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7RKrrfjFS+ft9eiQ8yP6Li/4iIeAuBrHvuA8exf87Qk=; b=LiPKcMC+rTio+UFgAUPZpOYWXvyzjVvZsAbfyusUj8Tsa+jL7gaXkiePQDIbliF1Ho M7Ukj0DRUur36ZFQPs3BTEyVHG/QhesvgELLOgoYPGwzbYT0eJiWbyqqxNWoq9OTBHq+ 27NsOyB5twpdhKF/ZxacFsG/wWXL01zvXPkFRLZq+2iUohfyiu/NaJ4GwWNreHmwPtiT LVdFWg4k7WP11tsjhkKA1F7oUSijujEmfXvSTfsoc1rLFLJkLDRZmvrsA2zQd9t/mhYY vmgSr1XOEB0m0yRz8ALU85E/z4yFaAv2ctXSrmfs8OgTtVoF9KhSGU4QzR5l/QVXDCLe Pk3A== MIME-Version: 1.0 X-Received: by 10.181.13.82 with SMTP id ew18mr25355514wid.84.1426858844371; Fri, 20 Mar 2015 06:40:44 -0700 (PDT) Received: by 10.28.62.84 with HTTP; Fri, 20 Mar 2015 06:40:44 -0700 (PDT) In-Reply-To: <550C1EC3.8000106@gmail.com> 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> Date: Fri, 20 Mar 2015 13:40:44 +0000 Message-ID: To: Rowan Collins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d043c7ccc9040ca0511b87625 Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: bowersbros@gmail.com (Alex Bowers) --f46d043c7ccc9040ca0511b87625 Content-Type: text/plain; charset=UTF-8 Okay, Still not sure how we can implement a range of strings. But since thats for a different feature, I'll leave that issue for now. In the list you provided, all of the ones for positional slicing will definitely be implemented. Question: What would be the best name for this feature? I do like *positional slicing,* but I'm sure there are better names out there. Since it isn't exclusively array based, and is entirely based on the index position (not key), positional slicing makes sense, and allows for the future to have key slicing implemented with their own separate documentation pages provided and clear naming for the differences between them. On 20 March 2015 at 13:21, Rowan Collins wrote: > Alex Bowers wrote on 20/03/2015 13:10: > > $array['x':'z'] = []; // Remove all elements with keys between 'x' and >> 'z', inclusive > > > I believe i mentioned in the past about strings not being allowed for > ranges, since there is no real way to check this (and this appears to be by > key not by index) which should be a separate RFC thread, assuming this one > gets accepted to be expanded upon. > > > I'm carrying over my syntax from previous examples - [a:b] meaning a > key-based slice (which implies accepting string keys, because there's no > reason not to) vs [@a:b] meaning a positional slice. See my earlier mail on > the 6 different types of access - I do realise you're not planning to > implement them all, just playing with the implications of different > decisions if we carry them through consistently in the future. > > Regards, > -- > Rowan Collins > [IMSoP] > --f46d043c7ccc9040ca0511b87625--