Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60846 invoked from network); 22 Jul 2008 11:08:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2008 11:08:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:56390] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/A2-46193-2CFB5884 for ; Tue, 22 Jul 2008 07:08:51 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id A2535414400B; Tue, 22 Jul 2008 11:09:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7FH3qZim7oSM; Tue, 22 Jul 2008 13:09:48 +0200 (CEST) Received: from [192.168.80.139] (unknown [195.226.16.50]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 4610C4144009; Tue, 22 Jul 2008 13:09:48 +0200 (CEST) Cc: PHP Developers Mailing List , kalle@zesix.com Message-ID: <6BD46F4A-2733-4160-9A3E-AD49F3002865@pooteeweet.org> To: Lukas Kahwe Smith In-Reply-To: <8A5D4032-1FC4-44BB-90F3-61B802F10159@pooteeweet.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Date: Tue, 22 Jul 2008 13:07:07 +0200 References: <8A5D4032-1FC4-44BB-90F3-61B802F10159@pooteeweet.org> X-Mailer: Apple Mail (2.928.1) Subject: Re: [PHP-DEV] closures questions From: mls@pooteeweet.org (Lukas Kahwe Smith) On 22.07.2008, at 13:04, Lukas Kahwe Smith wrote: > 1) Closures on class properties just don't work, the only way to do > it is > to do something like: > > $c = $a->b; > $c(); > > Calling: $a->b(); will result in method A::B() does not exists. would be nice to get this fixed, but at worst it should be documented. > 2) Closures can be defined as constants values because of its > toString method: > > define('Closure', function(){ echo 'Test'; }); > > echo constant('Closure'); /* (string) Closure object */ > > 3) Since Closures have this toString method, but its not showing up > in Reflection: > > Reflection::export(new ReflectionClass('Closure')); so do we even want the toString() method? > 4) var_export() and Closures is useless, any call to var_export() > like the example > below will all be the same: > > $lambda = function() > { > echo 'Λ Lambda'; > }; > > var_export($lambda); > > /* > Closure::__set_state(array( > )) > */ > > Maybe it could return some relevant information for exporting the > closure across > data not a huge biggy to me. > 5) Its impossible to clone a closure using the cloning keyword: > > $a = function(){}; > $b = clone $a; > > This makes it hard to make a copy of the closure because of objects > always are > passed by reference. I guess this is a draw back from the OO approach (rather than the original resource approach), but solvable? regards, Lukas Kahwe Smith mls@pooteeweet.org