Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39622 invoked from network); 3 Jun 2014 20:44:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2014 20:44:45 -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.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:47494] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/9D-64944-BB33E835 for ; Tue, 03 Jun 2014 16:44:44 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 107552000DD; Tue, 3 Jun 2014 16:44:41 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.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 LDJCAHtzTpwz; Tue, 3 Jun 2014 16:44:40 -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 D35CE2000DF; Tue, 3 Jun 2014 16:44:39 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <538E316E.8080105@gmail.com> Date: Tue, 3 Jun 2014 21:44:36 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <238F3085-29E5-473C-9668-BA937BD538FE@ajf.me> References: <6E3D6B3F-1BD6-42A2-B59C-12B9D6D597ED@ajf.me> <3A13FF39-6AF4-4A0C-A503-897C39023768@ajf.me> <538E316E.8080105@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 3 Jun 2014, at 21:34, Rowan Collins wrote: > Personally, I think its distinctive role as turning a bare-word into a = string key is the only justification for this syntax at all, and if I = ever used it, it would be exclusively for "struct"-type arrays, where = the keys adhered to a strict template. In fact (similar to the = discussion of "symbols" earlier) a new "struct" type (copy-on-write like = an array, but with keys never added or removed after declaration) might = be an interesting idea to explore. >=20 > Allowing quoted strings on the left-hand side also opens up questions = about other possibilities: if you can have quoted strings, why not = numeric keys as well? And then, what about [$foo: 'bar']? Is that still = a syntax error, and if so, will it be obvious to users why that is? And = then we're back to the bare-word=3Dconstant problem again: the only = distinction between ":" and "=3D>" would be "force the left-hand side to = be evaluated as a string, not a constant name", which just seems kind of = confusing. Yeah. Upon further reflection, I think supporting strings too would be = silly here. My only real rationale was to parallel my hypothetical = future object literals, but that=92s silly. (Also, looks like I can=92t = implement them anyway.) On a different topic, structs are indeed an interesting idea. Perhaps = they could be a resurgence of PHP4-style objects? I note that Apple=92s = new =93Swift=94 language has structs and classes, where it seems structs = are essentially identical to classes except that they have value instead = of reference semantics. But that is a discussion for another thread. -- Andrea Faulds http://ajf.me/