Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38467 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71029 invoked from network); 20 Jun 2008 14:37:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2008 14:37:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=waqner@gmx.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=waqner@gmx.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.net designates 213.165.64.20 as permitted sender) X-PHP-List-Original-Sender: waqner@gmx.net X-Host-Fingerprint: 213.165.64.20 mail.gmx.net Received: from [213.165.64.20] ([213.165.64.20:48714] helo=mail.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/CD-16112-3B0CB584 for ; Fri, 20 Jun 2008 10:37:41 -0400 Received: (qmail invoked by alias); 20 Jun 2008 14:37:36 -0000 Received: from p5087B6D2.dip.t-dialin.net (EHLO p5087b6d2.dip.t-dialin.net) [80.135.182.210] by mail.gmx.net (mp063) with SMTP; 20 Jun 2008 16:37:36 +0200 X-Authenticated: #27239598 X-Provags-ID: V01U2FsdGVkX19UH2s+T6RUR3TCrm/l5tBREIWDAuouGTBbnomPyq gx9r0wv8Bhlcz5 To: internals@lists.php.net Date: Fri, 20 Jun 2008 16:33:08 +0200 User-Agent: KMail/1.9.9 Cc: Larry Garfield References: <4856A547.3080801@gmx.net> <485B5BCC.1060003@city.ee> <200806200729.40623.larry@garfieldtech.com> In-Reply-To: <200806200729.40623.larry@garfieldtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200806201633.08425.waqner@gmx.net> X-Y-GMX-Trusted: 0 Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP From: waqner@gmx.net (Alexander Wagner) On Friday 20 June 2008, Larry Garfield wrote: > > function ($x, $y) use ($a, $b, &$c) {}; > > I am not sure if "use" is the clearest word to use there (wouldn't lexical > there make more sense?) I agree. "use" for both namespaces and closures may not be a good idea. Otherwise +1 to this syntax for its low WTF-factor. Look like parameters. Behave like parameters. Also, allowing this for regular function definitions might be a nice long-term replacement for global. > I would be fine with requiring an explicit declaration of $this if it helped > avoid memory leaks. I would propose to always require explicit declaration of $this, even if there is no memory-leak problem. This would make it easier to distinguish plain lambdas from closures and would prevent closures from being created by accident. As functional programming is foreign to most PHP-developers, better to err on the side of being explicit. Gesundheit Wag -- Her vocabulary was as bad as, like, whatever.