Re: [DISCUSSION] Match expression

From: Date: Sun, 12 Apr 2020 09:48:22 +0000
Subject: Re: [DISCUSSION] Match expression
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-109592@lists.php.net to get a copy of this message
Hi George I appreciate your feedback. > One small decision that I personally disagree with is the usage of > => compared to using the colon as the switch statement does. I picked the => symbol because IMO the extra spacing and wider symbol visually separates the two sides better. The difference isn't huge, I don't have a strong preference either way. > Also, combining this with less/greater or equal than binary operators makes for a rather > confusing line in my eyes. I guess that depends on the lhs. For example, using the ternary operator has the opposite effect. ``` match (true) { // => $cond ? $foo : $bar => $val, // Better $val >= 42 => $val, // Worse // : $cond ? $foo : $bar: $val, // Worse $val >= 42: $val, // Better } ``` Regards, Ilija

« previous php.internals (#109592) next »