Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Print not printing

by Smylers (Pilgrim)
on Jun 27, 2005 at 10:50 UTC ( [id://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.

Smylers

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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://470205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found