Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34108 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2143 invoked by uid 1010); 19 Dec 2007 21:46:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 2113 invoked from network); 19 Dec 2007 21:46:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2007 21:46:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=troelskn@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=troelskn@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.236 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: troelskn@gmail.com X-Host-Fingerprint: 64.233.162.236 nz-out-0506.google.com Received: from [64.233.162.236] ([64.233.162.236:39218] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/15-06050-34199674 for ; Wed, 19 Dec 2007 16:46:49 -0500 Received: by nz-out-0506.google.com with SMTP id x7so1552355nzc.38 for ; Wed, 19 Dec 2007 13:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=jY1NOMSs/7ruGJ6Cdy2SAZrzaohhcy0Vjknhv1zcEzI=; b=ULAjP78q0K2VCEaT1gV8KenDrPG6XJHeUvUU0eu/AuDTXmyqkNWtjd2NiyX63UGQHsMyfnxq/2CeYE6SPanzQh243clNRn1Mdx/OGFXEeGMDrJHi+/nhRgr2sVT99iNZRVpX1xbr5iZOq8S1Eh73NDpZCtIlOjvpP9lHujTGGWk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=O5UBlbN94kgLkAXKkmZq+yrliXZfHIDuPAKLQ2ztfYwNVQ7zJWAqt9fXUvH6l1Kvr8udvv1CUorPsDX5ZTF3jno06QqXeIYxq/RntD9gn6AHJ8Rqj4FvpRAkN4p+s8uGfEDv5dVJwCol4KxKL4O9epo9C8FVT7OVICBO83loQBc= Received: by 10.141.163.12 with SMTP id q12mr333534rvo.265.1198100731881; Wed, 19 Dec 2007 13:45:31 -0800 (PST) Received: by 10.141.50.16 with HTTP; Wed, 19 Dec 2007 13:45:31 -0800 (PST) Message-ID: <98b8086f0712191345h7fe11a7kc5d34b0369754c8f@mail.gmail.com> Date: Wed, 19 Dec 2007 22:45:31 +0100 To: internals@lists.php.net In-Reply-To: <200712172341.54372.larry@garfieldtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <200712172130.08216.larry@garfieldtech.com> <4FADC266-873E-4FD2-BEC8-28EA9D833297@procata.com> <200712172341.54372.larry@garfieldtech.com> Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: troelskn@gmail.com ("troels knak-nielsen") On Dec 18, 2007 12:41 AM, Jeff Moore wrote: > Reading the prior discussion, I think either $_SCOPE['x'] or the > lexical $x syntax is fine for accessing local variables in the > enclosing scope. But closures also should also support $this and > static:: when the closure is defined in a method. While I realise that the possibilities of static scope in PHP, are intriguing, I really think it's a whole different discussion. Related, yes. Interesting, yes. But let's keep it separate, to avoid derailing the whole discussion. On Dec 17, 2007 8:46 PM, Stanislav Malyshev wrote: > 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? If the code block, which needs to create the function, could be run more than once, it would try to define the function twice, leading to a fatal error. Yes, I could guard it with is_function_defined(), but that wouldn't be pretty. Technically speaking, you're right, but I think aesthetics does have some weight. Or should. It's also my main gripe against create_function() in the first place. On Dec 17, 2007 8:46 PM, Stanislav Malyshev wrote: > First, about 100% on the first encounter for any user ever seeing > closures in any other language. Second, all the confusion possible, like So how big a part of PHP's userbase is that? I'm guessing, it's small. On Dec 17, 2007 8:46 PM, Stanislav Malyshev wrote: > 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?!" True, but the people who will anguish over lack of closures, are already tearing their hair out over create_function(). On Dec 17, 2007 8:46 PM, Stanislav Malyshev wrote: > I'm not sure I understand what you mean by "static scope" and "dynamic > scope", ... Static scope is a synonym for lexical scope. On Dec 17, 2007 8:46 PM, Stanislav Malyshev wrote: > scope", but anyway thing that looks like closure but works like regular > function definition that isn't - is not a very good idea, IMO. Yes, that's the primary problem with the patch. I don't think it's as big an issue, as you do and given the alternatives, I'm willing to make that sacrifice. How's other peoples take on this point? -- troels