Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48174 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6232 invoked from network); 3 May 2010 13:01:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2010 13:01:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=mathieu.suen@easyflirt.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mathieu.suen@easyflirt.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain easyflirt.com designates 91.199.255.56 as permitted sender) X-PHP-List-Original-Sender: mathieu.suen@easyflirt.com X-Host-Fingerprint: 91.199.255.56 python-06.easyrencontre.com Linux 2.6 Received: from [91.199.255.56] ([91.199.255.56:58293] helo=mail.easyflirt.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/3D-30103-229CEDB4 for ; Mon, 03 May 2010 09:01:24 -0400 Received: from [192.168.0.51] (office.easyrencontre.com [78.155.152.6]) by mail.easyflirt.com (Postfix) with ESMTPSA id 0EC926374D3 for ; Mon, 3 May 2010 15:01:20 +0200 (CEST) Message-ID: <4BDEC91F.9080305@easyflirt.com> Date: Mon, 03 May 2010 15:01:19 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: PHP internals Content-Type: multipart/alternative; boundary="------------060801060109080707050608" Subject: Closure local return From: mathieu.suen@easyflirt.com ("mathieu.suen") --------------060801060109080707050608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, The statement 'return' in a closure is now returning from the scope that evaluate the closure (evaluation scope). It could have been in an other way. It could mean return from the scope were the closure is create (define scope). May be it could be interesting to have a syntax for returning from the define scope. For example. $findedElment = $myList->selectIfAbsent($fooo, function(){ return 'No item founded'; //Retrun from the define scope }) //Do somthing with $findedElment So I am asking if there has been some discussion on it or if it could be added? Thanks --Mathieu Suen --------------060801060109080707050608--