On Tue, 21 Mar 2017 12:50:18 +0100, Elizabeth Mattijsen
<l...@dijkmat.nl> wrote:

> > 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 am in the opposite camp. I use this all the time, as - to me - it
makes perfect sense. I am rather consequent (in perl5) using the mix of
|| (between expressions) and or (between an expression and an action)

  expression or action;
  expression || expression and action;

> > I'd much rather see
> >  if not $PathAndName.IO.f { $PathAndName.IO.open(:w).close; }

I can live with that, but I still prefer the or, because it reads

> > 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 I really abhor/hate. *THAT* makes me have to read the line thrice

> Which to me reads:
>   Create the file unless it already exists.

To me it reads "Create the file". Oh shit I shouldn't have as some
idiot told me too late not to if it rains.

Program minds differ :)

> Liz

H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.25   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Attachment: pgpsm3TmyUPtj.pgp
Description: OpenPGP digital signature

Reply via email to