Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: If I was forced to program in another language, the Perl language feature I would miss most would be:

by Anonymous Monk
on Oct 17, 2006 at 20:37 UTC ( [id://578896]=note: print w/replies, xml ) Need Help??


in reply to Re: If I was forced to program in another language, the Perl language feature I would miss most would be:
in thread If I was forced to program in another language, the Perl language feature I would miss most would be:

It looks so nice and is so readable.

I disagree. It doesn't follow the code flow.

When debugging or analysing the code, you don't find out until the very end of the line whether or not you actually needed to read the line. By that point, you've had to read it anyway.

I find it quite jarring to read, for all but the simplest of expressions. Then again, I find the same thing for lists of English instructions, too.

unlink($file) && crack_password() && sacrifice_firstborn( $child ) && +take_over_world( $mwahahahaha ) if ( $ignore_all_that_just_kidding);
  • Comment on Re^2: If I was forced to program in another language, the Perl language feature I would miss most would be:
  • Download Code

Replies are listed 'Best First'.
Re^3: If I was forced to program in another language, the Perl language feature I would miss most would be:
by BerntB (Deacon) on Oct 18, 2006 at 02:52 UTC
    I mainly use it for returning error cases (as I showed) and for things like alternative initiation of variables:
    ... my($foo) = blah($yadda); $foo = barf->new() unless $foo; $foo = gazonkly() unless $foo; return ERROR_CODE if $foo < $boo; ...
    I am not exactly known for aesthetical good taste, but I like it. If you have a clearer way of writing things like that, please tell me.
      Is this what Perl's or-equals or defined-or-equals operators are for?
      $foo ||= barf->new(); $foo ||= gazonkly();
      or to only test undef:
      $foo //= barf->new(); $foo //= gazonkly();
      When code is written as

      if (<expr>) { statement }

      instead of

      statement if <expr>;
      you can mentally decipher the code in the order of control flow. That's what I prefer.

        I understand that traditional argument, the point is that I was using postfix if as an idiom in specific circumstances which make my code clearer.

        I specifically asked for "a clearer way of writing things like that", but you didn't answer -- which probably means you can't see a neater way, either.

        Update: Fixed spelling and a html tag so it worked. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found