Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42253 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7485 invoked from network); 14 Dec 2008 09:41:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2008 09:41:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=karpeles@ookoo.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=karpeles@ookoo.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ookoo.org designates 88.191.88.38 as permitted sender) X-PHP-List-Original-Sender: karpeles@ookoo.org X-Host-Fingerprint: 88.191.88.38 lamune.ookoo.org Linux 2.6 Received: from [88.191.88.38] ([88.191.88.38:45085] helo=Lamune.ookoo.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/27-47862-BD4D4494 for ; Sun, 14 Dec 2008 04:41:48 -0500 Received: (pmaild 924934 invoked for user karpeles@ookoo.org); Sun, 14 Dec 2008 10:41:40 +0100 Received: from [192.168.0.25] (30.3.207-77.rev.gaoland.net [77.207.3.30]) by Lamune.ookoo.org (phpinetd by MagicalTux ) with SMTP version 1.0; Sun, 14 Dec 2008 10:41:40 +0100 To: PHP Developers Mailing List In-Reply-To: <4944C651.1090801@lerdorf.com> References: <2D85B33E-889B-4214-9BB8-A12EFFFC641E@macvicar.net> <1229150500.30719.201.camel@localhost> <4BA26FE8A9634178B4CEBEFA818810D2@VEGA> <15E310EAB433466EAF996B252CBED2BB@pc> <49448D66.2030501@lerdorf.com> <28139bc0812132210p1ed94f4ds40e31ff499cf2e7@mail.gmail.com> <7463F1E1-A880-479F-9584-30FFCED6E614@gmail.com> <4944AA37.9030400@lerdorf.com> <234C8048-A00D-4AEE-A23E-5FA10EA85D6D@gmail.com> <4944AD36.7070406@lerdorf.com> <6C9F85B0-29B8-419C-8DD1-BA90135214D3@gmail.com> <4944C651.1090801@lerdorf.com> Content-Type: text/plain; charset=utf-8 Organization: ooKoo.org Date: Sun, 14 Dec 2008 10:41:40 +0100 Message-ID: <1229247700.30719.217.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Removing basic types from our JSON parser From: karpeles@ookoo.org ("M." =?ISO-8859-1?Q?Karpel=E8s?=) Le dimanche 14 décembre 2008 à 00:39 -0800, Rasmus Lerdorf a écrit : > > > will always work. The only question is what sort of variable foo will > end up being. The RFC says we have to wrap basic types in an array or > object, while currently we let the basic types through without the wrapper. I believe that for most people it will feel more natural if foo's type is not changed to an object or an array. However I notice with current Firefox (I don't have MSIE, and I'm too lazy to read the whole ECMA Script specs) that an array with only one element is represented by JavaScript the same way. ([ "foo" ]).toString().charAt(1) "foo".toString().charAt(1) document.write([ "foo" ]) document.write("foo") Both works the same in each case. Even alert() will display the value of the first element. IMO it might be possible to wrap values into arrays without breaking too much JS code (bools and other scalars will still not work as expected, and of course an array will not have strings functions) as I think most uses of json_encode() are for strings escaping. Mark