Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17218 invoked from network); 13 Apr 2009 08:17:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Apr 2009 08:17:57 -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:33590] helo=klutometis.wikitex.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/63-31755-435F2E94 for ; Mon, 13 Apr 2009 04:17: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 n3D8HrW1010862; Mon, 13 Apr 2009 03:17:53 -0500 Received: (from pcdanenb@localhost) by klutometis.wikitex.org (8.13.1/8.13.1/Submit) id n3D8Hrb6010861; Mon, 13 Apr 2009 03:17:53 -0500 Date: Mon, 13 Apr 2009 03:17:53 -0500 To: Justin Martin Cc: internals@lists.php.net Message-ID: <20090413081753.GC10458@klutometis.wikitex.org> References: <20090412025100.GA5493@klutometis.wikitex.org> <8B.71.31755.246E2E94@pb1.pair.com> <20090413080506.GB10458@klutometis.wikitex.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Fnord: I have seen the fnords. User-Agent: Mutt/1.5.16 (2007-06-11) Subject: Re: [PHP-DEV] Re: Closures and __FUNCTION__ From: pcd@roxygen.org (Peter Danenberg) > First, we define $foo and load it with NULL so that it is available for > referencing. It turns out loading $foo is superfluous; I can get away with just: $foo = function($foo) use (&$foo) { $foo(); } > Next, in terms of program logic, we create a closure with a lexical > ('use') variable of a reference to $foo, which is then assigned to > $foo. Thus, the reference to $foo in the closure declaration now > points to the closure itself. That much is clear; but why $foo is all of the sudden bound within the closure when I use by reference (&$foo) as opposed to use by value ($foo) is mysterious.