Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46791 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51384 invoked from network); 19 Jan 2010 04:12:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2010 04:12:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:2689] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/CC-22457-631355B4 for ; Mon, 18 Jan 2010 23:12:39 -0500 Received: (qmail 59340 invoked by uid 98); 19 Jan 2010 04:12:42 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 (clamdscan: 0.88.7/10308. Clear:RC:1(127.0.0.1):. Processed in 0.073592 secs); 19 Jan 2010 04:12:42 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 19 Jan 2010 04:12:42 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 18 Jan 2010 22:12:42 -0600 (CST) Message-ID: <2553.98.193.1263874362.squirrel@www.l-i-e.com> In-Reply-To: <4B54FC87.8070106@zend.com> References: <4B54FC87.8070106@zend.com> Date: Mon, 18 Jan 2010 22:12:42 -0600 (CST) To: "Stanislav Malyshev" Cc: "'PHP Internals'" User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] function call chaining From: ceo@l-i-e.com ("Richard Lynch") On Mon, January 18, 2010 6:27 pm, Stanislav Malyshev wrote: > I wrote a small patch that enables this kind of syntax in PHP: > > foo()(); > > What it means is that if foo() returns callable value (which probably > should be function name or closure) then it would be called. > Parameters > and more than two sets of () work too. > Of course, this is mostly useful for doing closures, and that was > primary drive for implementing it - to make working with closures and > especially function returning closures easier. > What does not work currently is $foo->bar()() - since it is > surprisingly > hard to tell parser it's not {$foo->bar}()() - which of course is not > what I want to do. > > The patch is here: http://random-bits-of.info/funcfunc.diff > > What do you think? If somebody has better idea btw - maybe make > something like {foo()}() - and make that work for any expression > inside > {} - that might work too. So, what do you think? If I understand what this does... I think it would be far easier to just keep using: $foo_closure = foo(); $foo(); then to try to deal with foo()(); foo()(); just seems a bit too arcane to me... -- Some people ask for gifts here. I just want you to buy an Indie CD for yourself: http://cdbaby.com/search/from/lynch