Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74682 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45960 invoked from network); 1 Jun 2014 19:56:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 19:56:55 -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 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap2-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:51749] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/E5-15017-6858B835 for ; Sun, 01 Jun 2014 15:56:55 -0400 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 005A15A00D1; Sun, 1 Jun 2014 15:56:50 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <538B8364.6000903@gmail.com> Date: Sun, 1 Jun 2014 20:56:47 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B8364.6000903@gmail.com> To: Rowan Collins 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 20:47, Rowan Collins wrote: > 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]. >=20 > However, in that case, the unquoted version represents a use of Ruby's = special "Symbol" type, which is actually a different fundamental type = from a String. So the following actually defines a 2-element hash, with = one Symbol key and one String key: >=20 > foo =3D { myKey=AD: 'bar'=AD, 'myKe=ADy' =3D> 'bob'=AD } > =3D> {:myKey=3D>"bar", "myKey"=3D>"bob=94} To look at another popular language, it=92s interesting Perl does the = opposite to PHP: Perl: %hash =3D ( =91key=92, =91value=92 ); PHP: $hash =3D [ =91key=92 =3D> =91value=92 ] Perl: %hash =3D ( key =3D> =91value=92 ); PHP: $hash =3D [ key: =91value=92 ] While Perl=92s =3D> is for unquoted strings, PHP=92s is for quoted = strings, which is bizarre considering PHP is Perl-inspired. :) -- Andrea Faulds http://ajf.me/