Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(tye)Re3: crafting a decent CLI

by tye (Sage)
on Jul 13, 2001 at 18:42 UTC ( [id://96416]=note: print w/replies, xml ) Need Help??


in reply to Re: crafting a decent CLI
in thread crafting a decent CLI

That is what if( EXPR ) { EXPR; EXPR } is for. So, no, I don't consider that a sensible use of do.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: crafting a decent CLI
by Abigail (Deacon) on Jul 13, 2001 at 18:51 UTC
    The point isn't that you find it sensible or not. The point was how easy it was for others to parse your code. You weren't assuming I had to parse the bare block I wrote to see whether it's used as a multi-pass loop, do you? I wrote it, so I know.

    If you want to get into style discussions, that's fine, but don't come with arguments "oh, I don't find it sensible so don't apply my arguments on my code".

    -- Abigail

      I'm pretty sure I've never seen "do { ... } if ...;" or similar. That is so pointlessly obfuscated that it is something I would avoid (such as in a coding standard) even more than I would avoid bare blocks as loops (which I also find can always be replaced with better alternatives). So I still jump to "loop" when I see ";\ndo {\n" and I will continue to. I also still don't jump to "loop" when I see a lone open bracket (and nobody should since most of the time they'd be wrong anyway).

      So a do loop is clearer than a bare block "loop". True, there is no guarantee against somebody writing something that clearly looks like a loop but is in fact an unclear and uselessly obfuscated non-loop. That isn't a concern when trying to decide how to make code easy to maintain. If you've got "do { ... } if ...;" in your code, then you've got worse problems to deal with first.

      - tye        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found