On 2020-05-17 14:43, ToddAndMargo via perl6-users wrote:
Although

    "say 'yes' if 'h:/'.IO.d"

is obscure to me and

    "say 'h:/'.IO.d.Bool"

is very easy for me to understand.


Hi Peter,

I think it would help if you knew how my
mind worked.

`if` to me is a Boolean function.  If this
expressions is true, do this, if not, do
something else.

This is what happens to me when I see expressions
like

    "say 'yes' if 'h:/'.IO.d"

if the expression (h:/.IO.d) is true, then
say the result of the expression test, not the
result from the expression.  I have to figure
out what the results from the expression are
and why it is passing or failing the test.

Two steps in my mind.  Not that I can't figure
things like this out, I just don't like the effort,
when it can be avoided.  The way I look at it, the
time it takes me to write five extra letters (.Bool)
will save me ten times that amount of time trying to
figure out what I did 5 days or 5 years from now.
Dr. Demming (Quality circles, Kaisen, etc.) makes
a very strong point of this

And `if` can actually be very helpful at times:
   if  $x ~~ s/ "abc" /def/ {...;}
will tell you if the regex actually found "abc".
This I adore because I know is a test.  Not
in the least bit obscure.

.d is suppose to return a Boolen, but does not.
Some functions will convert the junk for you on
the fly.  Raku is very friendly this way.  Five extra
letters and I do not have to wonder who does what
to whom.

Yes, I am a bit weird.

Thank you for all the wonderful explanations!  Very
much appreciated.

-T

Reply via email to