Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52601 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20327 invoked from network); 31 May 2011 22:05:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2011 22:05:11 -0000 Authentication-Results: pb1.pair.com header.from=shadda@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=shadda@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: shadda@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:54164] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/52-25701-61665ED4 for ; Tue, 31 May 2011 18:05:10 -0400 Received: by pwj3 with SMTP id 3so2434928pwj.29 for ; Tue, 31 May 2011 15:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=9JR56fOxD9S0QNN/g8JbD9r6t37VaE42e9ZWSLRL6lQ=; b=kW7vKQXKWFGzjmbaq5vNvh8sYlK2D755Lw78Im9i8knTCVCE23Xgz8gKS47RkcD9gE 9PH5rSr6FqXKvBHz+eDEDns4Y77VWau2TawrBdBHu+1QPNlrmGJdbqRdcoU8TQhZ4/UE OWrba/luhqUoi7RpYvXqNHKCOMZi2X5jCtK38= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=HGjvLoflGIpALWqMBbQmJlvgoTY9gMztyMiocDeWKUEPSlifZeXp9Ry+Q/tEvU0BBY 1r3MCasnGbkC52N8bud2yd7zf+xbynqnGhleHCyjfJoL2bBPb/huxMCCKuVNoBFpT9aq HBbmcBiw7q0ogsd7jFsG3tTLm78Xj9UgEoR7s= Received: by 10.68.30.7 with SMTP id o7mr2526961pbh.75.1306879506639; Tue, 31 May 2011 15:05:06 -0700 (PDT) Received: from mattw-mbp.adknowledge.com ([204.137.29.243]) by mx.google.com with ESMTPS id n1sm386910pbi.47.2011.05.31.15.05.04 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 May 2011 15:05:05 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Tue, 31 May 2011 17:02:59 -0500 Cc: Rasmus , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <45513D8B-9EA4-429F-8C8E-2521465CB98A@gmail.com> References: <4DE5368A.6050603@moonspot.net> <2BFFEAC1-395E-4101-9452-002E63DCFD91@seancoates.com> <4DE55AB7.9050206@lerdorf.com> <4DE55CDA.302@sugarcrm.com> <4DE560D4.2010409@lerdorf.com> To: Dan Birken X-Mailer: Apple Mail (2.1084) Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: shadda@gmail.com (Matt Wilson) Exactly my point. Why try to fudge json into php, instead of just = improving php? On May 31, 2011, at 5:02 PM, Dan Birken wrote: > Yes it does :) >=20 > I guess my point was it would be confusing if PHP supported JSON-like > syntax, but json_decode(X) was different from eval(X). So if PHP = isn't > going to use JSON syntax (because it doesn't work for assoc arrays), = then I > don't think there is much benefit in using *almost* JSON syntax. >=20 > It just seems simpler that: > array(1, 2) equals [1, 2] > array(1 =3D> 2) equals [1 =3D> 2] >=20 > -Dan >=20 > On Tue, May 31, 2011 at 2:42 PM, Rasmus wrote: >=20 >> On 05/31/2011 02:34 PM, Dan Birken wrote: >>> It is worth noting that point you bring up is one that is present in = PHP >>> currently: >>>=20 >>> php > print_r(json_decode(json_encode(array('a' =3D> 'b')))); >>> stdClass Object >>> ( >>> [a] =3D> b >>> ) >>>=20 >>> php > print_r(json_decode(json_encode(array('a', 'b')))); >>> Array >>> ( >>> [0] =3D> a >>> [1] =3D> b >>> ) >>=20 >> Sure, but that makes makes perfect sense, does it not? Javascript = does >> not have associative arrays. So any non-scalar array has to be mapped = to >> a Javascript object in order to be represented. When we bring it back = we >> map a Javascript object to a PHP object, however, there is an = optional >> argument on json_decode() to change that to an associative array if >> desired. >>=20 >> The point we are making is that this exact inability of the json >> notation to distinguish an associative array from an object makes it = a >> problematic choice for a native syntax in PHP. >>=20 >> -Rasmus >>=20