Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Hidden Benefit of Perl Syntax

by Nkuvu (Priest)
on Jan 08, 2008 at 00:26 UTC ( [id://660979]=note: print w/replies, xml ) Need Help??


in reply to Hidden Benefit of Perl Syntax

More than once I've seen people get tripped up when adding statements to conditional blocks without braces. I've done this myself, not claiming to be perfect or anything. For example, adding lines to code like:

if (condition) some_statement();

Resulting in the "obviously wrong if you know what you're looking for but surprisingly easy mistake to make" code:

if (condition) some_statement(); some_other_statement(); some_random_statement();

Added: I mean "obviously wrong" when the code change required is to add the "some_other_statement" and "some_random_statement" to the conditional. If you just look at the second code snippet without some other context, it's not clear whether it's just an indentation issue or an error due to lack of braces.

Replies are listed 'Best First'.
Re^2: Hidden Benefit of Perl Syntax
by Tux (Canon) on Jan 08, 2008 at 07:33 UTC

    Obvious wrong is in the eye of the beholder. If you happen to (have to) work with someone who doesn't care about indentation at all, and yank/puts code lines from other places without giving them the correct indentation, you end up with code blocks that look wrong, but are actually exactly what he meant.

    Guess I should be moving to hates-software ...


    Enjoy, Have FUN! H.Merijn
Re^2: Hidden Benefit of Perl Syntax
by tye (Sage) on Jan 08, 2008 at 00:30 UTC

    That is why Python is clearly superior to these other languages.

    - tye        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found