in reply to To parens or not parens in chained method calls
Interesting question. The compelling criteria for me is consistency. A function/method call is a function/method call regardless of the number of parameters passed. So I include the () even if no parameters are passed in the call.
However, like Athanasius I use the Perl built in functions like length without parens. If pressed for a justification for the inconsistency I'd suggest functions like length are more like operators.
Very likely my long C++ experience biases what "looks right" to my eye in this case. My path to my current Perl style almost exactly mimics Athanasius's tale. I would make pretty much the same arguments, except in this small case where I'd apply the "make things that are the same look the same" rule - a call is a call regardless of the number of parameters.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To parens or not parens in chained method calls
by stevieb (Canon) on Feb 17, 2017 at 00:45 UTC |