Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74667 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23508 invoked from network); 1 Jun 2014 18:38:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 18:38:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; 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:48738] helo=imap7-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/01-15017-7037B835 for ; Sun, 01 Jun 2014 14:38:00 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 7A2C260384; Sun, 1 Jun 2014 14:37:56 -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 O2XwzZCLt3SA; Sun, 1 Jun 2014 14:37:56 -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 144876037A; Sun, 1 Jun 2014 14:37:54 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <538B6D49.3030402@sugarcrm.com> Date: Sun, 1 Jun 2014 19:37:51 +0100 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <2F19394F-C75C-40E8-94C3-507FAA9ADE28@ajf.me> References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B6D49.3030402@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] [RFC] Bare Name Array From: ajf@ajf.me (Andrea Faulds) On 1 Jun 2014, at 19:13, Stas Malyshev wrote: > You can already do stringKey =3D> 3 :) Yes, but then you=92ll get: Notice: Use of undefined constant stringKey - assumed = 'stringKey' in Command line code on line 1 > And saving characters is not really > a big priority. Well, we already replaced array() with []. I think it is reasonable to = consider saving characters in other places. It=92s not a *big* priority, = no, and we shouldn=92t do it excessively, but if common cases are = cumbersome, we should try to deal with them. Array literals with string keys and dereferencing arrays with string = keys are extremely common in PHP. So I think this reduction would = benefit most users, especially those who deal with JSON and the like = (which I do a lot in my on code), as this makes declaring arrays to be = serialised more convenient. Also, foobar: just looks nicer than =93foobar=94= =3D>, especially when you have syntax highlighting. > Changing language syntax and making millions of people > to learn new syntax just to save a couple of chars does not look like = a > big win to me. We did it for array(), I think we should do it again. Also, yes, = millions might have to learn the new syntax, but I think it is simple = and intuitive. It is not difficult to learn, and hey, perhaps millions = can benefit, especially since both target very common cases (I expect = they=92re the most common, except for numerical indexes) when dealing = with arrays. -- Andrea Faulds http://ajf.me/