Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43686 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75411 invoked from network); 13 Apr 2009 21:34:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Apr 2009 21:34:59 -0000 Authentication-Results: pb1.pair.com header.from=pcd@roxygen.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pcd@roxygen.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain roxygen.org from 72.51.35.14 cause and error) X-PHP-List-Original-Sender: pcd@roxygen.org X-Host-Fingerprint: 72.51.35.14 klutometis.wikitex.org Linux 2.6 Received: from [72.51.35.14] ([72.51.35.14:41246] helo=klutometis.wikitex.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/BD-22673-000B3E94 for ; Mon, 13 Apr 2009 17:34:57 -0400 Received: from klutometis.wikitex.org (localhost.localdomain [127.0.0.1]) by klutometis.wikitex.org (8.13.1/8.13.1) with ESMTP id n3DLYicq026483; Mon, 13 Apr 2009 16:34:44 -0500 Received: (from pcdanenb@localhost) by klutometis.wikitex.org (8.13.1/8.13.1/Submit) id n3DLYhID026482; Mon, 13 Apr 2009 16:34:43 -0500 Date: Mon, 13 Apr 2009 16:34:43 -0500 To: Stanislav Malyshev Cc: Peter Danenberg , internals@lists.php.net Message-ID: <20090413213443.GA26403@klutometis.wikitex.org> References: <20090412025100.GA5493@klutometis.wikitex.org> <49E3A890.2060009@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49E3A890.2060009@zend.com> X-Fnord: I have seen the fnords. User-Agent: Mutt/1.5.16 (2007-06-11) Subject: Re: [PHP-DEV] Closures and __FUNCTION__ From: pcd@roxygen.org (Peter Danenberg) > function Y($F) { > $func = function ($f) { return $f($f); }; > return $func(function ($f) use($F) { > return $F(function ($x) use($f) { > $ff = $f($f); > return $ff($x); > }); > }); > } That's interesting; I should be able to implement tail-recursion in a similar fashion using, say, trampolines,[1] shouldn't I? > On the other hand, we may want to add some way to refer to the > closure currently being run. We should have this information, so it > should not be too hard to do. That would be great; we could even do some benchmarking against the Y-combinator (which I've always loved, but never used). Footnotes: [1] http://en.wikipedia.org/wiki/Tail_recursion#Implementation_methods