Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53075 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70220 invoked from network); 6 Jun 2011 19:54:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2011 19:54:44 -0000 Authentication-Results: pb1.pair.com header.from=sean@seancoates.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sean@seancoates.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain seancoates.com from 64.15.79.181 cause and error) X-PHP-List-Original-Sender: sean@seancoates.com X-Host-Fingerprint: 64.15.79.181 iconoclast.caedmon.net Received: from [64.15.79.181] ([64.15.79.181:45702] helo=iconoclast.caedmon.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/2E-23189-2803DED4 for ; Mon, 06 Jun 2011 15:54:43 -0400 Received: from localhost (localhost [127.0.0.1]) by iconoclast.caedmon.net (Postfix) with ESMTP id 370BB784051; Mon, 6 Jun 2011 15:55:46 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at iconoclast.caedmon.net Received: from iconoclast.caedmon.net ([127.0.0.1]) by localhost (iconoclast.caedmon.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id frjF-qBJspEx; Mon, 6 Jun 2011 15:55:44 -0400 (EDT) Received: from [10.0.1.13] (cpe-72-227-135-34.nyc.res.rr.com [72.227.135.34]) by iconoclast.caedmon.net (Postfix) with ESMTPSA id 30BC178404F; Mon, 6 Jun 2011 15:55:44 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Mon, 6 Jun 2011 15:54:24 -0400 Cc: PHP internals , Matthew Weier O'Phinney Content-Transfer-Encoding: quoted-printable Message-ID: <21477438-057D-41B4-98BF-C9D9689063E0@seancoates.com> References: <084D2F1E-87E7-44CF-B8B6-47A250AD928D@seancoates.com> <887FE7CFF6F8DE4BB3A9535F53AFD06A49306440@il-ex2.zend.net> To: Zeev Suraski X-Mailer: Apple Mail (2.1084) Subject: Re: [PHP-DEV] Object and Array Literals From: sean@seancoates.com (Sean Coates) >>> $foo =3D { >>> 'bar' : function(){ >>> echo 'baz'; >>> } >>> }; >>>=20 >>> $foo->bar(); >>=20 >> I guess it's not yet too late to surpass Perl in the front of = obscurity... >=20 > Since the stuff to the right of the assignment operator (`:` in this = case) is valid PHP, I don't see why this wouldn't be allowed if we adopt = the {} syntax. It's not much different from this, which is currently = valid: >=20 > $foo =3D (object)array( > 'bar' =3D> function () { > echo 'baz'; > } > }; Matthew pointed out to me (on IRC) that this actually doesn't work in = current PHP (you can't call an object property as a closure without one = of the proxy functions like call_user_function_array()). My mistake. Note that this shouldn't affect the RFC, and this behaviour should be = addressed as a separate issue if people think it should work (FWIW, I do = obviously think this should work, but that's a separate thread, please). S=