Re: so as a method: Is this expected or a bug?

2018-12-21 Thread Brad Gilbert
You got the order of operations wrong. Method calls happen before prefix operators These are identical +@a.so +(@a.so) @a.so.Numeric @a.Bool.Numeric +?@a As are these +«@a».so +«(@a».so) @a».so».Numeric @a».Bool».Numeric +«?«@a Postfix operators also ha

Re: so as a method: Is this expected or a bug?

2018-12-21 Thread Laurent Rosenfeld via perl6-users
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 a écrit : > A snip

so as a method: Is this expected or a bug?

2018-12-21 Thread Richard Hainsworth
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