Closure local return

From: Date: Mon, 03 May 2010 13:01:19 +0000
Subject: Closure local return
Groups: php.internals 
Request: Send a blank email to internals+get-48174@lists.php.net to get a copy of this message
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

« previous php.internals (#48174) next »