Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74669 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26476 invoked from network); 1 Jun 2014 18:47:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 18:47:45 -0000 Authentication-Results: pb1.pair.com header.from=kassner@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kassner@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: kassner@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:44239] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/B1-15017-0557B835 for ; Sun, 01 Jun 2014 14:47:45 -0400 Received: by mail-wi0-f173.google.com with SMTP id bs8so3494082wib.6 for ; Sun, 01 Jun 2014 11:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=+u2yS8crfR0XoM9EPT5JJGIrT8DmrW0VwS1dqpm8lvY=; b=B4DTbioHMWmzlyKDbglUxckRd5OzbO+W5Zn64BETJ8UuAeyOIihwM9Kv0r+OcND3xs 68CAWWKPKo1iWSM9x9bd1fMQ0vF2o1xCfZzuwjTjI2KfXLHllLoCiTi+Se9DMo10FvOX OmU1R0oHSFNVX1vmoG7KAV+wMd0//uZtloAEGrCXEbkbYkYLAxAmkjXLS6EPfIN7XEYn /ucReWXLELlSsCZONAl/egIvghSbpnD58ukmDuvzXkj7tzHHH60tVsjoMEthWbd5y5tA xHwGQXn5k6bf7jfYFeBE6tH9izEHyvDnUtDAfajYvgT6v7xxEw2yCoRm0U6O2QeORev9 34Ng== X-Received: by 10.194.108.5 with SMTP id hg5mr42655030wjb.57.1401648461511; Sun, 01 Jun 2014 11:47:41 -0700 (PDT) MIME-Version: 1.0 Sender: kassner@gmail.com Received: by 10.194.2.47 with HTTP; Sun, 1 Jun 2014 11:47:21 -0700 (PDT) In-Reply-To: <2F19394F-C75C-40E8-94C3-507FAA9ADE28@ajf.me> References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B6D49.3030402@sugarcrm.com> <2F19394F-C75C-40E8-94C3-507FAA9ADE28@ajf.me> Date: Sun, 1 Jun 2014 15:47:21 -0300 X-Google-Sender-Auth: Jika1_uF6odvmSNGwPQP1tMXhUU Message-ID: To: Andrea Faulds Cc: Stas Malyshev , PHP internals Content-Type: multipart/alternative; boundary=089e0103defaa606b704facab629 Subject: Re: [PHP-DEV] [RFC] Bare Name Array From: kassner@php.net (Rafael Kassner) --089e0103defaa606b704facab629 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This causes a huge backward incompatibility: define('KEY', 'foo'); > $data =3D array(KEY =3D> 'bar'); Should $data have 'foo' or 'KEY' as element? AFAIK, some frameworks use this constants in array keys. On Sun, Jun 1, 2014 at 3:37 PM, Andrea Faulds wrote: > > On 1 Jun 2014, at 19:13, Stas Malyshev wrote: > > > You can already do stringKey =3D> 3 :) > > Yes, but then you=E2=80=99ll 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=E2=80=99s not a *big* prio= rity, no, > and we shouldn=E2=80=99t do it excessively, but if common cases are cumbe= rsome, 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 =E2=80=9Cfoobar=E2=80=9D = =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 intuitiv= e. > It is not difficult to learn, and hey, perhaps millions can benefit, > especially since both target very common cases (I expect they=E2=80=99re = the most > common, except for numerical indexes) when dealing with arrays. > -- > Andrea Faulds > http://ajf.me/ > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --089e0103defaa606b704facab629--