Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49349 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47586 invoked from network); 11 Aug 2010 15:52:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2010 15:52:51 -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.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:41517] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/98-01618-257C26C4 for ; Wed, 11 Aug 2010 11:52:51 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id B940E700483A; Wed, 11 Aug 2010 16:52:47 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id eKKNC7OJuN6h; Wed, 11 Aug 2010 16:52:47 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 808EC700345D; Wed, 11 Aug 2010 16:52:47 +0100 (WEST) Received: from damnation.dulce.lo.geleia.net (52.152.108.93.rev.vodafone.pt [93.108.152.52]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 636DF200707B; Wed, 11 Aug 2010 16:52:45 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: =?utf-8?Q?Johannes_Schl=C3=BCter?= Cc: "internals@lists.php.net" References: <1281535067.1132.15.camel@guybrush> <1281537421.1132.16.camel@guybrush> Date: Wed, 11 Aug 2010 16:52:35 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_IST?= Message-ID: In-Reply-To: <1281537421.1132.16.camel@guybrush> User-Agent: Opera Mail/10.60 (Win32) Subject: Re: [PHP-DEV] Closures as methods (and Closure::bind) From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Wed, 11 Aug 2010 15:37:01 +0100, Johannes Schl=C3=BCter = wrote: > On Wed, 2010-08-11 at 15:29 +0100, Gustavo Lopes wrote: >> >> > * What about allowing properties with function names as >> strings or >> > array($obj_or_class, 'method'), won't that be needed for >> being >> > consistent with local variables? >> >> Well, you cannot do "$a =3D 'phpinfo'; $a();" as well, so it's >> consistent with that. I think what you refer to would only make sense= >> if that were allowed. > > You can. This is valid. > OK, I know where I got this idea. "$a =3D 'phpinfo'; $a();" is actually = the = only valid case. array callbacks or 'Foo::bar' are forbidden. In order to be called as instance methods, the closure properties needs = to = have a bound instance -- preferably -- very preferably -- the instance = where the closure is stored. In this case, it doesn't make sense to allo= w = 'function' to be called, because then we wouldn't have anything with whi= ch = to fill the $this pointer. I guess it could make some sense for static calls, though. -- = Gustavo Lopes