> On 21 Mar 2017, at 12:38, ToddAndMargo <toddandma...@zoho.com> wrote:
> This is just one of those chatter posts.
> To me, the holy grail of coding is maintainability,
> which is why I code in Top Down.
> Code like below get my goat because I have to look
> at it several times before I realize what is going on
> $Name.IO.f or $Name.IO.open(:w).close;
> Basically the above says:
>    If the the first part of the logical OR passes,
>    then don't bother testing the second part.  And
>    if the second part of the Logical OR passes or
>    fails, then "so what”.

FWIW, I agree with you.  I don’t like the use of and/or in this capacity.  But 
many people swear by it.  To each its own.

> I'd much rather see
>  if not $PathAndName.IO.f { $PathAndName.IO.open(:w).close; }
> Which to me says:
>    If this does not pass, then do something about it.
> To me, it is much more maintainable.

And then there is the postfix if/unless way, which I personally like:

  $PathAndName.IO.open(:w).close unless $PathAndName.IO.f;

Which to me reads:

  Create the file unless it already exists.


Reply via email to