Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88591 invoked from network); 20 Mar 2015 18:29:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 18:29:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:36236] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/33-64120-8346C055 for ; Fri, 20 Mar 2015 13:17:29 -0500 Received: by wgra20 with SMTP id a20so95955344wgr.3 for ; Fri, 20 Mar 2015 11:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=biya6oWwzXEW3nJ76EL83JNqMhe/ZH34lB685lso3VE=; b=XNjgaFmIb+B8kG8lSUUjm7AB/5ehthTpytBFlG6VmaZabWNfKU8zV9cqOSQl9UN+oW uodG7w1iITxeiKykE+av4pY1IVUWWcdyOuGOt1lS9o/cIbYr/t1Llqo7hcTJAATfAcg0 qTGXH1lxPCf19U1srfrp8DjLPWFFJfuVK4ZTFuJwnhmf2lPKOnFY4b99kZ4NthHSTK+q WfbLFVSHjsxUBT+colx2whfkvet0bJIbIF5hg8lbvvNn9dANaldJyxWY6JFeCNCE2+1q LJB9bNcwkI6QV1KcneZ604fppv0lFbYTiQenOodwyzMrnTLNy4XBh1UkgnMDn0s7l+Ow v2cA== X-Received: by 10.180.13.146 with SMTP id h18mr26383021wic.73.1426875444912; Fri, 20 Mar 2015 11:17:24 -0700 (PDT) Received: from [192.168.0.159] ([62.189.198.114]) by mx.google.com with ESMTPSA id p5sm4016941wiz.20.2015.03.20.11.17.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 11:17:23 -0700 (PDT) Message-ID: <550C6422.6080009@gmail.com> Date: Fri, 20 Mar 2015 18:17:06 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Leigh , Alex Bowers CC: internals@lists.php.net 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> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: rowan.collins@gmail.com (Rowan Collins) Leigh wrote on 20/03/2015 16:17: > > For $thing[-1] I think this only works for strings (and I have this > implemented, should probably RFC it) > https://github.com/lt/php-src/tree/string_negative_offset > > $thing[-1:] is in scope for arrays though > Why? Getting the last value of an array is just as useful as getting the last character of a string. It doesn't work *with that syntax*, because -1 is a valid key, just as $thing[0] can't mean "first value of array" because it already means "value with key 0". That's why I propose a new syntax such as $thing[@0], $thing[@-1], etc. Regards, -- Rowan Collins [IMSoP]