Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74683 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48275 invoked from network); 1 Jun 2014 20:03:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2014 20:03:41 -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:37756] helo=imap7-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/76-15017-C178B835 for ; Sun, 01 Jun 2014 16:03:40 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id AF00D60378; Sun, 1 Jun 2014 16:03:37 -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 pB6JHe+RIOzT; Sun, 1 Jun 2014 16:03:37 -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 51A856037A; Sun, 1 Jun 2014 16:03:35 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: Date: Sun, 1 Jun 2014 21:03:32 +0100 Cc: Rowan Collins , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <538B8364.6000903@gmail.com> To: Adam Harvey 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:56, Adam Harvey wrote: > 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). The problem with Ruby-style symbols is twofold. First, we don=92t have a = free character in PHP to use to denote a symbol, so it would have to be = two characters. In that case, there=92d be no advantage in using it over = a string. Secondly, Ruby-style symbols are completely separate from = strings, with symbol keys and string keys being different. Nothing in = PHP deals with symbols, however, everything deals with strings. So for = it to be useful we=92d either have to start using it everywhere, which = won=92t happen, or have it just be another syntax for strings, which = would be useless as it=92s no shorter. > 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 =97 > 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. I=92m not entirely sold on :> either, but it=92s the best idea I=92ve = had so far. I made a single RFC as I think the two features are = complementary. As both use T_STRING, anything you can define with : you = can dereference with :>, and the colon in :> is obviously inspired by = the colon syntax. I may consider splitting the proposals into their own = RFCs yet, though. I want to hold separate votes, anyway. -- Andrea Faulds http://ajf.me/