Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84563 invoked from network); 5 Jun 2011 21:03:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2011 21:03:55 -0000 Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:40999] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/51-26000-93FEBED4 for ; Sun, 05 Jun 2011 17:03:55 -0400 Received: by bwz18 with SMTP id 18so3324464bwz.29 for ; Sun, 05 Jun 2011 14:03:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.46.162 with SMTP id j34mr2924923bkf.210.1307307830207; Sun, 05 Jun 2011 14:03:50 -0700 (PDT) Received: by 10.204.119.6 with HTTP; Sun, 5 Jun 2011 14:03:50 -0700 (PDT) In-Reply-To: <084D2F1E-87E7-44CF-B8B6-47A250AD928D@seancoates.com> References: <084D2F1E-87E7-44CF-B8B6-47A250AD928D@seancoates.com> Date: Sun, 5 Jun 2011 23:03:50 +0200 Message-ID: To: Sean Coates Cc: PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Object and Array Literals From: j.boggiano@seld.be (Jordi Boggiano) Thanks for working on this. On Sun, Jun 5, 2011 at 3:30 AM, Sean Coates wrote: > Please read, and if you have a comment that is not already covered in the= RFC, raise it here. I'm definitely open to discussion, but I would really = love to keep this discussion civil. TBH, I dropped half-way through the original topic, so I'm sorry if I missed something, but why don't we just treat {"foo":"bar"} as an array? json_decode() can do it, and it makes complete sense since PHP arrays are hashes too. I don't see much benefit to having this create an object by default, especially since even if you use that notation to send data to a JSON API, json_encode'ing a hash will create an object. It's the only pain point I really have, that I can't use true json-syntax without ending up with this messy pile of objects/arrays mixed together. If we do this, IMO the hashes should not be able to be defined with [], but that'll probably upset people, so I don't really care if it is possible. > =A0 =A0 =A0 =A0=95 Strictness of unquoted keys. This is just legacy crap honestly, if we make up new syntax, we shouldn't include the old mess in it. I think everyone is quoting their strings by now.. > =A0 =A0 =A0 =A0=95 Support =3D> in addition to : as a key:value separator= . Same as my point on [] above, I think adopting the JSON notation should be done fully, keeping this stuff in might be ok to make people happy, but it does not make much sense. > =A0 =A0 =A0 =A0=95 possibility of simply not supporting the \u### syntax = for Unicode characters in literal strings (just like the rest of PHP). This is still PHP strings, they should behave as such. Sounds good to me. > =A0 =A0 =A0 =A0=95 Should mixed-format (numeric and associative arrays) b= e allowed? (e.g. [1,'two':2, 3]) Assuming we keep [] to arrays and {} to hashes as I said above, I'd say no. In the rare cases that it is useful you can still use array() if you really feel this is necessary.. I'm sure many people will disagree with this, and I don't really mind how it ends up syntactically speaking, but please really consider dropping the stdClass part, that'd really suck :/ Cheers --=20 Jordi Boggiano @seldaek :: http://seld.be/