Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55737 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68000 invoked from network); 7 Oct 2011 18:59:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2011 18:59:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:48055] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/50-00384-2FB4F8E4 for ; Fri, 07 Oct 2011 14:58:59 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 56C0670003FA for ; Fri, 7 Oct 2011 19:58:55 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 8gCtRHkq77N8 for ; Fri, 7 Oct 2011 19:58:55 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 1C41A70003C6 for ; Fri, 7 Oct 2011 19:58:55 +0100 (WEST) Received: from cataphract-old.dulce.lo.geleia.net (cataphract-old.dulce.lo.geleia.net [IPv6:2001:470:94a2:2:9978:6e7:759:40ee]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id B909E2005811 for ; Fri, 7 Oct 2011 19:58:53 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "internals@lists.php.net" References: <4E5B24DD.10903@sugarcrm.com> <4E671355.5060908@sugarcrm.com> Date: Fri, 07 Oct 2011 19:58:40 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_IST?= Message-ID: In-Reply-To: User-Agent: Opera Mail/11.51 (Win32) Subject: Re: [PHP-DEV] 5.4 beta From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Fri, 07 Oct 2011 18:31:42 +0100, Ferenc Kovacs wrote: > do we have a wiki/documentation about what exactly ended up in 5.4 > from the Closure improvements? (Rebind) > https://wiki.php.net/rfc/closures/object-extension#privateprotected_members_scope > is really hard to read, as it contains all of the suggested ideas and > possible solutions, etc. > if not, maybe someone with the required knowledge could start working > on adding the documentation? > I don't think so, but if I had to summarize the innovations in 5.4, this would be it: - Closures can now have an associated scope - Closures can now have a bound object - Closures can now be either static or non-static - Closures defined in a place with an active scope are scoped accordingly - Closures defined inside an instance method (or bound closure) have a bound object (namely $this) - Closures are static if defined within a static method or with the static keyword (static function() { ... }) static => !bound (but it's false that !static => bound) bound => scoped !static && scoped => bound (i.e., if !static, scoped <=> bound) The bound instance and the scoped can be freely changed with Closure::bind and $closure->bindTo, subject to these constraints. -- Gustavo Lopes