Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54355 invoked from network); 8 Dec 2012 22:36:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2012 22:36:08 -0000 Authentication-Results: pb1.pair.com header.from=steve@mrclay.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=steve@mrclay.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mrclay.org from 50.22.11.19 cause and error) X-PHP-List-Original-Sender: steve@mrclay.org X-Host-Fingerprint: 50.22.11.19 bedford.accountservergroup.com Linux 2.6 Received: from [50.22.11.19] ([50.22.11.19:49414] helo=bedford.accountservergroup.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/D5-13109-6D0C3C05 for ; Sat, 08 Dec 2012 17:36:07 -0500 Received: from ip68-101-74-66.ga.at.cox.net ([68.101.74.66]:61882 helo=[192.168.11.20]) by bedford.accountservergroup.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1ThT07-0007nj-EU for internals@lists.php.net; Sat, 08 Dec 2012 16:36:03 -0600 Message-ID: <50C3C0D4.1040600@mrclay.org> Date: Sat, 08 Dec 2012 17:36:04 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bedford.accountservergroup.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - mrclay.org Subject: Re: [PHP-DEV] Call closure stored as object property directly without use of temporary variable From: steve@mrclay.org (Steve Clay) Adam, On 12/8/12 4:48 PM, Adam Jon Richardson wrote: > call closures that are stored as object properties directly without having > to make use of a temporary variable. ... > $o = new stdClass(); > $o->func = function(){ > return 'Yes!'; > }; > $o->func(); The following expression avoids PHP's dilemma of distinguishing prop/method, but fails because you can't execute an expression: ($o->func)(); Similarly if $a is a Closure, $a() works but ($a)() fails. If these could be made to work, would it break BC? And *should* they be made to work? Steve Clay -- http://www.mrclay.org/