Hi Richard,

I don't think it's a bug.  In:
put +@a.so;
the @a array is coerced into a Boolean value (True) by the so method, and
the resulting Boolean value is then coerced into an integer by the +
operator.
Cheers, Laurent.




Le ven. 21 déc. 2018 à 09:28, Richard Hainsworth <rnhainswo...@gmail.com> a
écrit :

> A snippet:
>
>      my @a = 1..10;
>      put +@a.so; # output 1
>      put so(+@a); # output True
>      put (+@a).so; # output True
>
> This caught me because I used +@s.so when I tried to do something like:
>
>      # in a class with 'has Bool $.pass;'
>      return unless ( $!pass = +@a.so );
>      # fails with a Type mismatch of Int being assigned to Bool
>
> Is this an expected result, or a bug?
>
>
> (I was going to ask this on StackOverflow, but it seems so like a bug
> that I decided to ask here first)
>

Reply via email to