Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42478 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45835 invoked from network); 5 Jan 2009 05:04:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2009 05:04:00 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.116 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.116 us-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [63.205.162.116] ([63.205.162.116:1678] helo=us-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/F7-07052-FB491694 for ; Mon, 05 Jan 2009 00:04:00 -0500 Received: from [192.168.17.39] ([192.168.17.39]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 4 Jan 2009 21:04:42 -0800 Message-ID: <496194BC.9040401@zend.com> Date: Sun, 04 Jan 2009 21:03:56 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Marcus Boerger CC: internals@lists.php.net, Dmitry Stogov , Lukas Kahwe Smith , =?ISO-8859-15?Q?Johannes_Schl=FCter?= References: <272365052.20090104173130@marcus-boerger.de> In-Reply-To: <272365052.20090104173130@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Jan 2009 05:04:42.0054 (UTC) FILETIME=[1E424E60:01C96EF3] Subject: Re: [PHP-DEV] [RFC] Closures, Lambdas and use From: stas@zend.com (Stanislav Malyshev) Hi! > some time back (August 08) I complained about 'use' being at a weird > position and not at the same place as 'global' or 'static' where I > expected it. Back then Dmitry asked me to provide a patch to check out > the alternative. Now during the holidays I finally found some time to > change from: > $f = function() use ($x) {} > to: > $f = function() { use $x; } > > Patch is attached. > > Comments? I don't really see any "consistency" in it - this "use" syntax has nothing to do with other "use" (namespace one) even if it looks almost exactly like one in proposed patch. It also is subtly different from global or static - different enough to make people think "ok, 'global' is always by ref and 'use' looks like 'global' for consistency reasons - does it mean it is consistently by-ref?" Not to mention questions like "can I write 'use' in the middle of the code, since I can do it with "consistent" constructs like 'static' or 'global'? What if I refer to the variable before - will it be already bound?", etc. I think it would not improve code readability and not really make it "consistent" anyway. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com