Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85258 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 681 invoked from network); 20 Mar 2015 01:28:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 01:28:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=bowersbros@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bowersbros@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.171 as permitted sender) X-PHP-List-Original-Sender: bowersbros@gmail.com X-Host-Fingerprint: 74.125.82.171 mail-we0-f171.google.com Received: from [74.125.82.171] ([74.125.82.171:33980] helo=mail-we0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/A4-25408-8D77B055 for ; Thu, 19 Mar 2015 20:28:56 -0500 Received: by wegp1 with SMTP id p1so70991573weg.1 for ; Thu, 19 Mar 2015 18:28:53 -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=VG2cvv1/EEFmCfuHtMICMYLkcUGzhcrRb3pttW1f3E0=; b=oDdpeFsB2NeYk0UOqVnI6Xf4Kr7vu0wWEhiC6CEe8KdOSdW5i5O520taGsQGpjqKqn AgJN1xuos4D2qdgZeyVkpcB1UpjwNq8fe1Mh9ZZ6na7tjCvityDpzu6CdSQrKIvSg/oV 9a/nAqUkeYxhY6u4zmFFMKZfVVNA1F945p2XnZ4La7zjloxbO306Vg22xplPGAT3yH1h vsmEcvROuXFeSVWKyCqNmzTlQqI5Spl0eP/i9um8L1Gs3BwgHPNNc7AEHpYUOeKaK9qV RpzxH4nFMZxMymMcB6h46bN5ws/e1sPO+7ePP8bmFXoRYUJCfNVnU4G3EtBTxWhqsOip ulkw== MIME-Version: 1.0 X-Received: by 10.181.13.82 with SMTP id ew18mr21105636wid.84.1426814933702; Thu, 19 Mar 2015 18:28:53 -0700 (PDT) Received: by 10.28.62.84 with HTTP; Thu, 19 Mar 2015 18:28:53 -0700 (PDT) In-Reply-To: <550B7189.4040608@gmail.com> References: <550B5A81.1090706@gmail.com> <550B7189.4040608@gmail.com> Date: Fri, 20 Mar 2015 01:28:53 +0000 Message-ID: To: Rowan Collins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d043c7ccc489f4e0511ae3d75 Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: bowersbros@gmail.com (Alex Bowers) --f46d043c7ccc489f4e0511ae3d75 Content-Type: text/plain; charset=UTF-8 > > I'm not sure why it would duplicate the item like that. My interpretation > of $array[$start:$end] would be "an array containing all those elements of > $array with a position more than or equal to $start, but less than or equal > to $end" ($position >= $start && $position <= $end). > I agree with this statement now, I was misinterpreting how I thought it should work, but reading this; I think you're right. Also, your next point about the unique array indexes covers it anyway, so it doesn't really matter regardless. Check my example again. $countdown[0] refers to the element with key 0, so > is absolutely not a replacement for $countdown[0:0]. This is the whole > point of my example. You're correct, this was my mistake. I'm not sure what you mean by "something that happens nowhere else" PHP has > syntax for all sorts of things, using all sorts of symbols. Your own > suggestion uses the : symbol in a place where it currently can't exist. What I mean by 'symbol' here, is a prefix to tell it what the context of its use is; in this case, it is the declaration that we are requiring the index not the key. As far as I'm aware, and can think of at the moment, PHP has nothing like a hinter symbol. The only purpose of this symbol is to tell the user that it is indexes not keys. Maybe there should be a symbol to declare that, but i'm not sure. Will appreciate more comments on this. If we go the direction of using a symbol, what should be the outcome of the symbol missing? fatal error, or to try to slice based on the keys? --f46d043c7ccc489f4e0511ae3d75--