Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34072 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32433 invoked by uid 1010); 17 Dec 2007 19:46:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32417 invoked from network); 17 Dec 2007 19:46:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2007 19:46:58 -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 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:29283] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/47-20687-B22D6674 for ; Mon, 17 Dec 2007 14:46:57 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 17 Dec 2007 21:46:45 +0200 Received: from [192.168.16.91] ([192.168.16.91]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 17 Dec 2007 11:46:42 -0800 Message-ID: <4766D222.7000406@zend.com> Date: Mon, 17 Dec 2007 11:46:42 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: troels knak-nielsen CC: internals@lists.php.net References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <4764CC64.3040608@zend.com> <623025726.20071217140947@marcus-boerger.de> <698DE66518E7CA45812BD18E807866CE0108180B@us-ex1.zend.net> <98b8086f0712171137k5ac9b4aau4a720662b0ba99be@mail.gmail.com> In-Reply-To: <98b8086f0712171137k5ac9b4aau4a720662b0ba99be@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Dec 2007 19:46:42.0637 (UTC) FILETIME=[8C58AFD0:01C840E5] Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: stas@zend.com (Stanislav Malyshev) > Functionally, create_function() is a variation of eval, which allows > you to create new code at runtime. Static lambda is syntactic sugar > for creating a function in the global scope, without knowing its name > at compile time. Static lambda is more restrictive than While we are at it, what's wrong with knowing the name? I can see why closure can be fun when you can dynamically use outer-scope variables. But when you can't, what exactly prevents one from just doing the function? > two considerations to take here; First, how probable is it, that users > will make this assumption? And second, how much confusion will it > cause to those, which it affects? First, about 100% on the first encounter for any user ever seeing closures in any other language. Second, all the confusion possible, like "oh, closures! cool! let me do this and that! what, I can't use variables?! Are you kidding me?! WTF is it useful for?!" > place. The simple rule, that PHP has dynamic scope, should be simple > to understand for anyone who actually knows the difference. I'm not sure I understand what you mean by "static scope" and "dynamic scope", but anyway thing that looks like closure but works like regular function definition that isn't - is not a very good idea, IMO. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com