Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52975 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91527 invoked from network); 5 Jun 2011 21:18:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2011 21:18:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=dukeofgaming@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dukeofgaming@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dukeofgaming@gmail.com X-Host-Fingerprint: 74.125.83.42 mail-gw0-f42.google.com Received: from [74.125.83.42] ([74.125.83.42:40918] helo=mail-gw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/D2-26000-3B2FBED4 for ; Sun, 05 Jun 2011 17:18:43 -0400 Received: by gwb17 with SMTP id 17so1526099gwb.29 for ; Sun, 05 Jun 2011 14:18:39 -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:from:date :message-id:subject:to:cc:content-type; bh=ynVPlmox7O+BgwjFNnmXhgoZ+uNboaF+JXhJmZA5xco=; b=dAjpCWxR7PGhNcsFnlTJg/9X+viHFmJAXnHM7Ss4lfoGWo/vjIUspff2r+dN6c6ME0 VTtHXOxk8rbkzpH0lfIu7zC1eKahHmE9FQJo3rNxedf5T4dlDVdEWqgF8betCghM3NLo WxkmGWkdT8vk7n0sxH7sS/8zleNy1muD69oA4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=LlCTS/CXWZYPiU6f/hbM6JOhV8SqjlzBh5xUfPLPXzFHlMJyQFu/TLFnPVDwGOLfGA TWfbvYS7OcnRthI4K3UVu1K5okAJH+g/JM+yUf3VyHYqREWBHsdWN3ETCYMyQ2LUOb23 j4/JMQSTM4i2ZQvEeueuNASgHamycuNx+XWZM= Received: by 10.101.181.17 with SMTP id i17mr3020346anp.65.1307308719187; Sun, 05 Jun 2011 14:18:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.96.15 with HTTP; Sun, 5 Jun 2011 14:18:19 -0700 (PDT) In-Reply-To: References: <084D2F1E-87E7-44CF-B8B6-47A250AD928D@seancoates.com> Date: Sun, 5 Jun 2011 16:18:19 -0500 Message-ID: To: Chris Stockton Cc: Jordi Boggiano , Sean Coates , PHP internals Content-Type: multipart/alternative; boundary=001636c92addd1a5b004a4fd87e9 Subject: Re: [PHP-DEV] Object and Array Literals From: dukeofgaming@gmail.com (dukeofgaming) --001636c92addd1a5b004a4fd87e9 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I like the idea of supporting both "=3D>" and ":". Would this work?: $foo =3D { 'bar' : function(){ echo 'baz'; } }; $foo->bar(); And I'm guessing this shouldn't work: $array =3D array('foo' : 'bar'); Regards, David On Sun, Jun 5, 2011 at 4:11 PM, Chris Stockton w= rote: > 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 > 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. > > > >> =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.. > > > >> =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. > > > >> =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 m= e. > > > >> =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. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001636c92addd1a5b004a4fd87e9--