Re: Closure local return

From: Date: Mon, 03 May 2010 15:42:18 +0000
Subject: Re: Closure local return
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-48178@lists.php.net to get a copy of this message
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

« previous php.internals (#48178) next »