Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74665 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19483 invoked from network); 1 Jun 2014 17:59:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 17:59:22 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.248 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.248 imap7-3.ox.privateemail.com Received: from [198.187.29.248] ([198.187.29.248:53613] helo=imap7-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/40-15017-8F96B835 for ; Sun, 01 Jun 2014 13:59:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 241AE60388 for ; Sun, 1 Jun 2014 13:59:18 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap7.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bKIHsoFdCoPP for ; Sun, 1 Jun 2014 13:59:18 -0400 (EDT) Received: from [192.168.0.200] (unknown [90.203.28.11]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 6230760387 for ; Sun, 1 Jun 2014 13:59:16 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Message-ID: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> Date: Sun, 1 Jun 2014 18:59:13 +0100 To: PHP internals Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) X-Mailer: Apple Mail (2.1878.2) Subject: [RFC] Bare Name Array From: ajf@ajf.me (Andrea Faulds) Good evening, I have created an RFC containing two proposals. The first is a less cumbersome syntax for arrays. At present, string = keys in arrays are declared like this: =93stringKey=94 =3D> 3, That=92s a whole five characters, seven including spaces, for your most = common case (identifier-like key). In JavaScript, you can avoid quoting = the key for this common case. I propose something similar for PHP. Where = the key fits the profile of IS_STRING, this RFC proposes that you can do = this instead: stringKey: 3, Now it=92s only two characters, three including spaces, for the most = common case. It makes declaring arrays more convenient. The second proposal is a less cumbersome syntax for dereferencing arrays = with string keys. At present, you need to do this: $myArray[=93foobar=94][=93andSoOn=94][=93moreKeys=94][=93etc=94] That=92s four characters per dereference. Yet for objects, only two are = needed: $myObject->foobar->andSoOn->moreProps->etc Thus, this RFC also proposes the following syntax for dereferencing = arrays with string keys, where said keys fit the profile of IS_STRING: $myArray:>foobar:>andSoOn:>moreProps:>etc The :> syntax can be considered provisional, I=92m open to better = alternatives. The two proposals will be voted on separately, but I=92m making a single = RFC as they=92re related and complement each other. The RFC is here: https://wiki.php.net/rfc/bare_name_arrays Please read it and tell me your thoughts. I already have a completely = working patch with tests available. Thanks! -- Andrea Faulds http://ajf.me/