Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74681 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45282 invoked from network); 1 Jun 2014 19:56:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 19:56:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.173 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.173 mail-ie0-f173.google.com Received: from [209.85.223.173] ([209.85.223.173:46092] helo=mail-ie0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/C5-15017-A658B835 for ; Sun, 01 Jun 2014 15:56:28 -0400 Received: by mail-ie0-f173.google.com with SMTP id lx4so3695279iec.18 for ; Sun, 01 Jun 2014 12:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=kbDhFbhNX2QL6S/dQnHD4/xQxCgqORCPlcobUEERM54=; b=DymUOI+mpsrFH1odpPGd4hf7RtaKCKCrHLiShmnkjrnDJfvHxHOb/xD/MMqPUB9b3p tRoHR8o0RCpfMzgwSFVRL66g2CjQ6EO71SNUbOYNfCiDi0XPiT02TrPVEfWFXNMkN3rn kXxpa5jVYJdCBxmqJ8YhD7jhxGcBgurmK+fUg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=kbDhFbhNX2QL6S/dQnHD4/xQxCgqORCPlcobUEERM54=; b=DnwPvVNtHGAO9/5+W64/x0pd2opaMs9i4eTT5qj2eBy77Xk5R2QdcL8q4X1Bs4bLtS ClHYMfgijXcEvLdzD2d40U4+UiqSIuXy5zjS78vyplrzl4l5eB4xrDQSkSwffovI39ny QEGjNxzJG/MwW5OpsCOdxRza9HHUiXNMutD/1biLghmj1xaCIWVwfu1ze6owl8Mfs6ab lFvC2d10Dy+3dPwAkpn5uqmj5SBqlDw/Tx9k+NoUQLm1wEWb6NETprpYSK0t3wXCN/Lc TTwtFQFGNpjsWklc/00c3iJgEU4eHKsNoIRuI7c1mMnGRbC6RAp4QZlj2nCCpu5tnHih 4Adg== X-Gm-Message-State: ALoCoQlQCadqlsLvNn03/eu42R1QGx6qu6wnqADKrm4HF/pUUMPhe7Z3UUOSt05N7g4Wy9rqbxCW X-Received: by 10.50.253.163 with SMTP id ab3mr14222000igd.35.1401652584083; Sun, 01 Jun 2014 12:56:24 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.254.138 with HTTP; Sun, 1 Jun 2014 12:56:03 -0700 (PDT) In-Reply-To: <538B8364.6000903@gmail.com> References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B8364.6000903@gmail.com> Date: Sun, 1 Jun 2014 12:56:03 -0700 X-Google-Sender-Auth: aVwzZ9tufi9lJ1Iq9UfXsxKjNaE Message-ID: To: Rowan Collins , Andrea Faulds Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Bare Name Array From: aharvey@php.net (Adam Harvey) On 1 June 2014 12:47, Rowan Collins wrote: > On 01/06/2014 18:59, Andrea Faulds wrote: >> >> The first is a less cumbersome syntax for arrays. At present, string key= s >> in arrays are declared like this: >> >> =E2=80=9CstringKey=E2=80=9D =3D> 3, >> >> [...] Where the key fits the profile of IS_STRING, this RFC proposes tha= t >> you can do this instead: >> >> stringKey: 3, > > > Interestingly, I notice Ruby's hash syntax has two variants very similar = to > this [http://www.ruby-doc.org/core-2.1.2/Hash.html]. > > However, in that case, the unquoted version represents a use of Ruby's > special "Symbol" type, which is actually a different fundamental type fro= m a > String. So the following actually defines a 2-element hash, with one Symb= ol > key and one String key: > > foo =3D { myKey=C2=AD: 'bar'=C2=AD, 'myKe=C2=ADy' =3D> 'bob'=C2=AD } > =3D> {:myKey=3D>"bar", "myKey"=3D>"bob"} You've mostly pre-empted the question I wanted to ask. :) Andrea, did you consider implementing something more like Ruby's symbols, rather than a variation on the existing array literal syntax? I feel like that might solve any potential ambiguities in terms of constant resolution (as mentioned in another subthread), wouldn't require a separate [foo: bar] variant on the existing syntax, and may be useful in other contexts too (such as array dereferencing). As for the array dereferencing syntax: it should probably be an RFC and patch on its own. To be honest, my initial reaction is negative =E2=80= =94 I think the proposed syntax blurs the lines between arrays and objects (I know it's a different digraph, but it's going to look really similar when scanning code), and I'm not yet sold on it being particularly useful. Adam, who's living in the future and typing this from an airborne plane. Very exciting.