Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48178 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41345 invoked from network); 3 May 2010 15:42:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2010 15:42:24 -0000 Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:45882] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/F5-09795-EDEEEDB4 for ; Mon, 03 May 2010 11:42:23 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 8B64E176B1E; Mon, 3 May 2010 17:42:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4ZKEoZCACkam; Mon, 3 May 2010 17:42:19 +0200 (CEST) Received: from [192.168.1.72] (gw-search.cyberlink.ch [212.55.194.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 228031767FA; Mon, 3 May 2010 17:42:19 +0200 (CEST) Message-ID: <4BDEEEDA.1050806@cschneid.com> Date: Mon, 03 May 2010 17:42:18 +0200 User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: "mathieu.suen" CC: PHP internals References: <4BDEC91F.9080305@easyflirt.com> In-Reply-To: <4BDEC91F.9080305@easyflirt.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: Closure local return From: cschneid@cschneid.com (Christian Schneider) mathieu.suen wrote: > 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 I think you actually misunderstand the difference in http://en.wikipedia.org/wiki/Closure_%28computer_science%29#Differences_in_semantics The way I read if the difference is wether it returns from the closure function or the surrounding function *calling* it. Not the *defining* scope. And no, it doesn't make sense in the PHP context IMHO. - Chris