On 2020-05-17 07:47, Brad Gilbert wrote:
Why do you have `.Bool` on all of the `.e` tests?

Hi Brad,

I do this because it keeps me out of trouble.

I want back a yes or no answer, not True or Fail
(X::IO::DoesNotExist).

And I never remember which IO.<some_letter> will return
a True or Fail or which function (`if` does) will
convert X::IO::DoesNotExist to a False for me.

Plus it makes it more readable for me.
   [something].IO.<someletter>.Bool
tells me instantly I will be getting back a yes
or no answer.

So if you want to be a purist, you can experiment with
which IO.<some_letter> are going to give you a yes
or no answer or which functions will convert X::IO::DoesNotExist for you. OR you can just tack .Bool
at the end and forgo the hair pulling.

Also the cryptograms in the documentation are not
correct.  For instance:

    https://docs.raku.org/routine/d

    method d(--> Bool:D)

Says it return a "Bool" not a "True" or "X::IO::DoesNotExist".
The modification to Bool is stated at the bottom of the page.

So, basically, it is to keeps me out of trouble.  And if
I am going to get `X::IO::DoesNotExist` back instead of
a Boolean, .Bool automatically converts it for me and
with no hair pulling.

So, basically, my LONG WINDED answer is that I do it for me.

-T

Reply via email to