In “Creeping featurism and the ratchet effect“, Mark Dominus discusses (among other things) how adding parentheses to an expression to disambiguate the operator precedence is a Bad Thing™. Of course, in the example where there are no operators in the parentheses –
next if !($file =~ (/txt/)); – he’s right:
(x) will never be more clear than
However, I find the argument for avoiding parentheses for disambiguation strange: Each parenthesis makes the code a little harder to read. Proper engineers should instead look up the answer whenever the precedence is ambiguous. This begs the questions: Which takes the most time?
Without parentheses, the developer will have to either know the precedence rules by heart (something even Mr. Dominus admits he doesn’t), or to check out a table in the documentation. But if Perl treats parentheses like most other languages, I’ll never have to look up that table if I’m using them. Even presuming that you’d keep the documentation in a nearby browser window when programming, I’d be hard pressed to think that it’s faster to switch application, look up the proper web page, switch back, and apply that piece of information, than simply looking at the code, and applying that piece of information directly. Even someone who’s only ever programmed in other languages would be able to understand such code without checking the manual.
Harddisk space is abundant, but developer time is not.