Perl doesn't require you to not use parenthesis so just add them in as required for your comfort level.Correct. And that's positive thing.
Why is that a problem?The problem is that it facilitate the creation of programs that are difficult to maintain and understand. It facilitates "cutting the corners" behavior. Unsafe programming style, if you wish.
Programmers who use other languages are conditioned to place parentheses in such cases. Perl breaks with this convention. Actually when I first encounted such style I first thought, "what a pervert, why he/she likes this nonsense; there is no gain in readability" :-) And was surprised again when the guy defended this style (with the exact example I provided)
And people almost never do things they can live without, although the widespread adoption of OO for projects that do not require it is an interesting exception that deserves a sociological study ;-)
That's also correct: you can do this, but the real question is "Will you?"get_config(split(/$s/), $_); get_config(split(/$s/, $_));
IMHO parentheses were removed my Perl maintainers in wrong places. I would preserve them in standard functions, but make it optional them in conditionals like if while for, etc. I spend a lot of time when I forget to balance parenthesis in if statements and I have those extra parenthesis in if.
It's a real Wild West: in prefix/regular conditional statements parenthesis are obligatory but in suffix conditionals they are optional. For example
The question is "Why?" Probably because the constructs like if $a {$b++}{$c++} would be ambiguous. So the decision to make parentheses optional in suffix conditionals only is wrong, because now prefix and suffix if statements are treated differently. But that can explain their popularity -- you remove one level of parentheses nesting (which in complex conditions can be three or more levels deep) and that makes code more readable.DB<101> unless defined($a) { print "OK" } syntax error at (eval 7)[/usr/share/perl5/5.26/perl5db.pl:738] line 2, + near "unless defined" DB<102> unless( defined($a) ){ print "OK" } OK DB<103> print 'OK' unless defined($a); OK
Note to zealots who consistently put negative ratings on my comments:
You prevent people who are not logged to the site from reading them and as such you censor my speech. Please remove them. This is a free forum not your clique watering place.
In reply to Re^11: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |