Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Print not printing

by Smylers (Pilgrim)
on Jun 27, 2005 at 10:50 UTC ( #470205=note: print w/replies, xml ) Need Help??

in reply to Re: Print not printing
in thread Print not printing

paranoia and excessive parenthesising is not such a bad thing after all..

Where can you put parens in the statement in question to make it be interpreted as addition printing to the currently selected filehandle? Others here have shown how a plus signs helps, but I haven't seen how parens would.

What actually avoids this affect from hurting you is having a sane whitespace style — something which has many benefits.

Excessive parenthesising is, by definition, excessive. Mostly in makes code harder to read for those of us who know (or can guess) the precedence rules — because you have to put effort in matching up the parens and satisfying yourself that they are indeed superfluous; they look so similar to necessary parens that they can't be quickly dismissed.


Replies are listed 'Best First'.
Re^3: Print not printing
by monarch (Priest) on Jul 05, 2005 at 14:27 UTC
    I upvoted the previous post because the post author makes a valid point about excessive parenthesising being confusing.

    However two things make parenthesising easier: one, taking advantage of editor features that highlight the matching paren (Emacs does this wonderfully, and I've no doubt that other editors do this as well); two, the knowledge that things can sometimes go very wrong when precedence is just assumed.

    I tend to use more parens that most people.. that's not to say that sometimes I will rely on operator precedence from time-to-time. Although that got me recently when I incorrectly assumed the precedence of the ? : ternary operator.

    Code readability is always important, and if parens are clogging up readability, then indentation and splitting an expression over several lines isn't such a bad thing either.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://470205]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-07-15 21:16 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (326 votes). Check out past polls.