Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34073 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93083 invoked by uid 1010); 17 Dec 2007 23:42:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93066 invoked from network); 17 Dec 2007 23:42:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2007 23:42:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=jeff@procata.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jeff@procata.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain procata.com from 207.58.169.145 cause and error) X-PHP-List-Original-Sender: jeff@procata.com X-Host-Fingerprint: 207.58.169.145 vps.procata.net Linux 2.5 (sometimes 2.4) (4) Received: from [207.58.169.145] ([207.58.169.145:54943] helo=vps.procata.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/93-59593-74907674 for ; Mon, 17 Dec 2007 18:42:03 -0500 Received: from c-76-112-12-49.hsd1.mi.comcast.net ([76.112.12.49] helo=[192.168.1.102]) by vps.procata.net with esmtp (Exim 4.63) (envelope-from ) id 1J4Pat-00054n-Ng for internals@lists.php.net; Mon, 17 Dec 2007 18:41:55 -0500 Message-ID: To: internals Mailing List In-Reply-To: <476582E6.7020808@zend.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Date: Mon, 17 Dec 2007 18:41:52 -0500 References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <4764CC64.3040608@zend.com> <98b8086f0712160324n653bbb61v17fbf1d364ae3b51@mail.gmail.com> <476582E6.7020808@zend.com> X-Mailer: Apple Mail (2.915) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.procata.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - procata.com Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: jeff@procata.com (Jeff Moore) Hello, 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. I think a solution for closures should add a new variable type. That way, the code can compiled at compile time, while the enclosing context (local variables plus $this for methods) can be captured at run time in the new variable type. Also, when the closure value is garbage collected, the references to the enclosing scope and object instance can also be freed. Additionally, the callback psuedo-type could be promoted to the new type, with the string or array representation converted when required. It wouldn't be necessary, but a callback literal along the lines of Array() could also be added to make the conversion unnecessary. I find the following to be easier to understand: set_error_handler(Callback("foo")); Than set_error_handler("foo"); The current syntax would still work because of automatic type conversion. Best Regards, Jeff