Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47666 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12406 invoked from network); 28 Mar 2010 01:14:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Mar 2010 01:14:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=davey@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=davey@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 207.97.245.193 as permitted sender) X-PHP-List-Original-Sender: davey@php.net X-Host-Fingerprint: 207.97.245.193 smtp193.iad.emailsrvr.com Linux 2.4/2.6 Received: from [207.97.245.193] ([207.97.245.193:45915] helo=smtp193.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/50-06536-38DAEAB4 for ; Sat, 27 Mar 2010 20:14:44 -0500 Received: from relay19.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay19.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 5C1471B4015; Sat, 27 Mar 2010 21:14:41 -0400 (EDT) Received: by relay19.relay.iad.mlsrvr.com (Authenticated sender: davey-AT-pixelated-dreams.com) with ESMTPSA id C3D271B400C; Sat, 27 Mar 2010 21:14:40 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=windows-1252 In-Reply-To: Date: Sat, 27 Mar 2010 21:14:36 -0400 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <9B2CB462-2FD9-47B6-A22F-8D81DA1E5884@php.net> References: <1269709768.7944.17.camel@guybrush> <28.76.22155.18B4EAB4@pb1.pair.com> <5EC8C94EFD714783A042A71FD52B6A46@pc> To: Bharat Nagwani X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] Proposal: shorthand object property setting syntax. From: davey@php.net (Davey Shafik) On Mar 27, 2010, at 3:59 PM, Bharat Nagwani wrote: > I might have missed earlier emails. How about this? >=20 > $myLongNameObject =3D new myLongNameObject { > property1: '11111', > property2: '22222', > property3: '33333', > property4: '44444', > property5: '55555', > }; >=20 > Can we avoid the new as well like in Javascript? >=20 > $myLongNameObject =3D { > property3: 'xyz', > property4: 'abc', > property5: 5, > property6: { > a: 1 > } > }; Except that "new myLongNameObject" and { } are not the same, your latter = syntax =97 just as in JavaScript =97 would yield an anonymous object, essentially the same as "new stdClass" :) You could just as easily do: $myLongNameObject =3D (object) array ( 'property3' =3D> 'xyz', 'property4' =3D> 'abc', 'property5' =3D> (object) array ( 'a' =3D> 1 ) );=