Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52971 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86258 invoked from network); 5 Jun 2011 21:11:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2011 21:11:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:64724] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/A1-26000-411FBED4 for ; Sun, 05 Jun 2011 17:11:49 -0400 Received: by qwi4 with SMTP id 4so1650224qwi.29 for ; Sun, 05 Jun 2011 14:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qNAhgNKtz2kvLDO3QgG0nCfhHtpjXckudwEjNzM6zAs=; b=FaDmpWZ6jNLnC6X+mIaHu9rNpkWHSI+792WDJ/1jaoKB4LHzMgQxgnaq1e6G5hlDD0 6KGm7iSfagnJ7nboYDUpIkdwRtzWIdGiV1F6xOFoRx9YYcCCdcV+ngs0i+xHSN6b9G7A 9u0RpHIeWlF23qHIYsVcINCEkcUl1dRRGixkQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IG13hHvBzr8MS22Btgu6qR7eMhylei3RQMkNFzuPO/xcGP4hY74G/b5dbt4rINgeTY 7IIGmyeEnFwOasRCZs7vd0Qpz+pcfso/4cGjhDNCo0XUfsVH44e5A0pxX/pbsLchweDs pwX3qLfQ3CYq0U4IH8JKaXTwsjawc4EE76xEg= MIME-Version: 1.0 Received: by 10.229.47.18 with SMTP id l18mr3071936qcf.55.1307308306152; Sun, 05 Jun 2011 14:11:46 -0700 (PDT) Received: by 10.229.189.1 with HTTP; Sun, 5 Jun 2011 14:11:46 -0700 (PDT) In-Reply-To: References: <084D2F1E-87E7-44CF-B8B6-47A250AD928D@seancoates.com> Date: Sun, 5 Jun 2011 14:11:46 -0700 Message-ID: To: Jordi Boggiano Cc: Sean Coates , PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Object and Array Literals From: chrisstocktonaz@gmail.com (Chris Stockton) Hello, On Sun, Jun 5, 2011 at 2:03 PM, Jordi Boggiano wrote: > 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 th= e 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 separato= r. > > 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) = be 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 I think there is a clear benefit to allow {} as well as [] being StdClass and array respectively. However, I understand your point as well as the point of others when they speak of the usefulness of StdClass, really this tells me perhaps we should look at adding some basic enhancements to StdClass (I.E. some methods for example), or perhaps a new class for default object creation. At the very least maybe a way to specify the "default" class.