The [+] works because of an optimization. If you use the core &infix:<+> it instead calls the .sum() method.
Since CArray has a sum method, that gets called instead. On Sun, Sep 30, 2018 at 4:28 AM Fernando Santagata <nando.santag...@gmail.com> wrote: > > Hi, > > I was hunting for a bug in my code, this one: > > my @a := CArray[int32].new: 6,3; > say [+] @a; # it should be "say [+] @a.list;" > > That statement prints "9", while changing the '+' with a '*' it generates an > error, as it should: > > Cannot resolve caller Numeric(NativeCall::Types::CArray[int32]: ); none of > these signatures match: > (Mu:U \v: *%_) > > Is this a bug, an inconsistency, or a necessary evil? > > -- > Fernando Santagata