Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77710 invoked by uid 1010); 28 Dec 2007 16:45:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77695 invoked from network); 28 Dec 2007 16:45:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Dec 2007 16:45:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=rsky0711@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rsky0711@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.224 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rsky0711@gmail.com X-Host-Fingerprint: 64.233.162.224 nz-out-0506.google.com Received: from [64.233.162.224] ([64.233.162.224:26178] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/BA-22266-31825774 for ; Fri, 28 Dec 2007 11:45:09 -0500 Received: by nz-out-0506.google.com with SMTP id x7so687868nzc.38 for ; Fri, 28 Dec 2007 08:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=R92lRFLBhyelQlTM244wjCHfDKwB8WdR5TZahJP0Tj0=; b=NWnc9lRgBNJtnRMHzpfzk1hEtp1RRgwy4jsKTHFHh807Q5ONJ80s00o8caa09154ZQ35g1JbQhp0sWzmc92ltb3vGTYzwJ4Zw/QP8PRsuix4LcHzozSegEdZNCsm2v/WHhJxCDcx1uECqvDok0lRqih7v7mcJDxlTST1jyU+Na0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=t3/Nkh/F1HoVM3AKRouPSd/xa6tlzHdOMqUolvFylIkqxZ300X/NmJh9fBBmyyasGjpYaU3Vwd+Lf8yBM1pF5gNlOL99TyOtK3xiakUsRP3Cc0aSMbB8tDgzcaU1IvlZ/DiZ59SuDfVIn0TblUhjLOLHpSXm+wmcX26yHELrlsY= Received: by 10.142.162.5 with SMTP id k5mr3083126wfe.171.1198860304024; Fri, 28 Dec 2007 08:45:04 -0800 (PST) Received: by 10.70.23.7 with HTTP; Fri, 28 Dec 2007 08:45:03 -0800 (PST) Message-ID: Date: Sat, 29 Dec 2007 01:45:03 +0900 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: PATCH: Implementing closures in PHP From: rsky0711@gmail.com ("Ryusuke SEKIYAMA") >any idea about the possibility of hash conflict? How about this patch? http://www.opendogs.org/pub/php-5.3dev-071228a.patch This patch is PHP 5.3 version of the patch I have introduced in my blog. (written in Japanese) 1. http://d.hatena.ne.jp/rsky/20071126/1196077860 2. http://d.hatena.ne.jp/rsky/20071128/1196260732 3. http://d.hatena.ne.jp/rsky/20071130/1196426672 This patch contains two features, anonymous function and square bracket array syntax. Anonymous function can be used in loop (does not exhaust memory as create_function() in loop), work with opcode caches and also can be called directly like JavaScript's one. For example: % php -r 'print_r(array_map(function($n){ return $n * $n; }, [1, 2, 3]));' Array ( [0] => 1 [1] => 4 [2] => 9 ) % php -r 'function($str){ echo $str, "\n"; }("foo");' foo More examples are included in this archive: http://www.opendogs.org/pub/php-5.3dev-071228-anon-patch.zip -- /** * Ryusuke SEKIYAMA * rsky0711@gmail.com */