Paren-free PHP? [on hold]
- by Ivan Curdinjakovic
I stumbled upon the idea for paren-free ecmascript (https://brendaneich.com/2010/11/paren-free/), which is inspired by Go language.
And it's simple, clean and cool - if you make braces required instead of recommended (and they are recommended everywhere anyway: http://www.php-fig.org/psr/psr-2/), then parenthesis are unneeded around control structure “heads”. It would work exactly the same in PHP. So, a piece of PHP code could look like this:
if $someVar == 42 {
doSomething();
}
or:
foreach $someArray as $key => $value {
echo "$key: $value";
}
It's a small, but nice step towards a nicer, cleaner syntax and removing unnecessary parts. The question is - would PHP community be willing to see the languange move in that direction? Would it be considered an improvement by majority, or are we too used to typing those parenthesis and unwilling to see any change in PHP syntax?