in reply to Re^6: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

Judging by the code I see at PerlMonks and in the various CPAN source I have looked at, post-fix statements are pervasive among experienced Perl users. I think partly this is true because they break through the clutter of more conventional languages to make "simple things simple" and clear.

It is somewhat the difference between writing short comprehensible sentences in prose and writing longer tortuous incomprehensible meandering sentences that are harder to parse and harder to understand. Perl encourages short comprehensible sentences.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
  • Comment on Re^7: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

Replies are listed 'Best First'.
Re^8: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by tobyink (Canon) on Sep 28, 2020 at 08:12 UTC

    For me, the choice between:

    consequence() if condition(); # or condition() and consequence();

    And the choice between:

    consequence unless condition(); # or condition() or consequence();

    Is mostly a question of front-loading. What part of the statement seems the most important in its context? If we're just trying to avoid warnings about undef values, then adding if defined $foo to the end of a statement seems less obnoxious than putting the condition up front. But if we're going to do a lot of processing on $line, then my $line = <$fh> or return; is probably clearer than return unless my $line = <$fh>;.

    A reply falls below the community's threshold of quality. You may see it by logging in.