Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39172 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59477 invoked from network); 22 Jul 2008 11:05:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2008 11:05:37 -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:44615] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/52-46193-00FB5884 for ; Tue, 22 Jul 2008 07:05:37 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id 745C04144009 for ; Tue, 22 Jul 2008 11:06:35 +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 E5bgitR6EsoV for ; Tue, 22 Jul 2008 13:06:34 +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 1C4EF414400F for ; Tue, 22 Jul 2008 13:06:34 +0200 (CEST) Message-ID: <8A5D4032-1FC4-44BB-90F3-61B802F10159@pooteeweet.org> To: PHP Developers Mailing List 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:04:03 +0200 X-Mailer: Apple Mail (2.928.1) Subject: closures questions From: mls@pooteeweet.org (Lukas Kahwe Smith) Hi, I am sending this on behalf of Kalle: 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. 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')); 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 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. regards, Lukas Kahwe Smith mls@pooteeweet.org