[php-src] Issue #9682: Switch for arrow fn(s)

From: Date: Thu, 06 Oct 2022 14:49:42 +0000
Subject: [php-src] Issue #9682: Switch for arrow fn(s)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242537@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9682 Author: kmirea ### Description JUst had a random thought & would like to put it out there (iassuming its not already in the works / possible0 A quick inline Switch for use on simple set of conditions, each of which result in a singular arrow function call / or enclosed statememnt, Idea being to be able to enclose case conditions & arrow function as key value pairs or array ellements m with the case list becoming a second situational argument for switch call, or even switch becomiung arrow fn or anon function. For break/continue could use the return type of arrow fn, or based on a byref arg of fn(), resuilt of either arrow fn itself, returning expr of null or false would cause a break, otherwise continues by default,l switch ( $cond , [ "case1" => fn(): bool => $expr1 ] , ["case2" => fn(): bool => fcall2()] , /*optional*/ return fn() => 'default' ) pretty sure this will break a few laws, or even attract some scorn, but just a wee bit overexcited about this glorious addition of the arrow function you have spoiled us with ! 🗡️ Appreciate avery one of you, and am counting the days now till all those who have sccoffed at the idea of php in the past, slink their way back hoping noone will notice 🗡️ Sidenote Q: Is there any possibility of or attempts made at reversion of compilledd globals back into AST statements ? is manual (re) construction the only way ? I ask this in the context of a situation where you have opcached files whith frequent revisions, and attempting to avoid having to replace them and recompile adnausium. Sorry4TheWall <3

« previous php.bugs (#242537) next »