Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38780 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21623 invoked from network); 5 Jul 2008 19:50:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jul 2008 19:50:32 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:39325] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/E1-10299-780DF684 for ; Sat, 05 Jul 2008 15:50:32 -0400 Received: from MBOERGER-ZRH.corp.google.com (203-82.106-92.cust.bluewin.ch [92.106.82.203]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 278C411F54A; Sat, 5 Jul 2008 21:50:29 +0200 (CEST) Date: Sat, 5 Jul 2008 21:50:06 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1264378041.20080705215006@marcus-boerger.de> To: Christian Seiler CC: php-dev List In-Reply-To: <486B6960.4030705@gmx.net> References: <486B6960.4030705@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch From: helly@php.net (Marcus Boerger) Hello Christian, cool progress and nice syntax. The only thing I was wondering of is whether the following would work: function replace_spaces ($text) { static $replacement = function ($matches) { return str_replace ($matches[1], ' ', ' ').' '; }; return preg_replace_callback ('/( +) /', $replacement, $text); } That is using static would result in creating the function only once. marcus p.s.: Given the current state, my take is put it in and finish the last two or three edgecases while namespace and GC mature. Actually we still haven't had the namespace syntax decision. All thta happened there was we will apply the patch as is and when it is done we'll discuss. Now when the namespaces were said to be ready someone just put the discussion down. Clever politics. However namespaces are imo far from being finished. Either way this feature is lkimited enough, stable enough, agreed up-on enough and gives something a lot of people were waiting for. Let's do it now. PHP 6 even when focused on will come with another ton of major new features. That is unicode, still pretty much untested. Also there are traits waiting and then we might want to have the taint model. Personally given it's last state of 1% slowdown I really want it. So put all together we should avoid 5.4 and put smaller features into 5.3 and once we're out with 5.3.1 we should close 5.2 branch, only apply fixes and security issues to 5.3 and get 6 in a working state. marcus Wednesday, July 2, 2008, 1:41:20 PM, you wrote: > Hi, > After some discussion with Dmitry, he and I have continued to improve > the current closure patch. You can find the current proposal with > patches for 5_3 and HEAD here: > http://wiki.php.net/rfc/closures > (Please read it again, I've changed quite a lot.) > Basically, it's the syntax with use ($lexical) in the function > declaration, optional references, optional static keyword for functions > that don't need $this and support for __invoke. I know that there was > some disagreement on the syntax (including by me) but I think this is > the best compromise we can achieve while still staying consistent with > PHPs current semantics and not breaking BC at all. > I've spoken to Dmitry and he said the patch will be committed to HEAD > soon. Since both Dmitry and I still want to have it in 5_3 too, we'd > want to ask for opinions on this again - especially since after quite a > lot of thorough review and discussion on this list basically all the > side-effects have been addressed and there are now quite a few tests > that ensure the correct behaviour of closures. Also, the patch is now > built in a way that the main functionality remains inside > zend_closures.c, so any possible not yet encountered bug can be fixed > without breaking binary compability. > Regards, > Christian Best regards, Marcus