Skip Menu |
Report information
Id: 122899
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: FROGGS.de <email [at] froggs.de>
rob [at] hoelz.ro
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Cannot apply trait 'is cached' on multi candidate
Download (untitled) / with headers
text/plain 788b
FROGGS m: multi foo(Int) is cached { say 'Int' }; multi foo(Str) { say 'Str' }; foo 1; foo 1; foo 'a'; foo 'a' camelia rakudo-moar b3331e: OUTPUT«Cannot invoke object with invocation handler in this context␤ in sub foo at /tmp/zWM01_TzeB:1␤ in block <unit> at /tmp/zWM01_TzeB:1␤␤» FROGGS :/ FROGGS I feared that lizmat that's odd, the wrap should only be applied to the first FROGGS m: multi foo(Int) is cached { say 'Int' }; foo 1; foo 1; camelia rakudo-moar b3331e: OUTPUT«Cannot invoke object with invocation handler in this context␤ in sub foo at /tmp/EpBFnacF6n:1␤ in block <unit> at /tmp/EpBFnacF6n:1␤␤» lizmat that's worthy of a rakudobug FROGGS m: sub foo(Int) is cached { say 'Int' }; foo 1; foo 1; camelia rakudo-moar b3331e: OUTPUT«Int␤» FROGGS yeah
Subject: Adding 'is cached' to a multi candidate causes an LTA error message
Download (untitled) / with headers
text/plain 549b
The attached file contains the following code: Show quoted text
> multi fib(0) { 0 } > multi fib(1) { 1 } > multi fib(Int $n where * >= 0 ) is cached { fib($n - 2) + fib($n - 1) } > > say fib(18);
...which, when run, results in the following error message: Show quoted text
> Cannot invoke object with invocation handler in this context > in block <unit> at test.p6:5
The proper way to fix this code is declare proto fib(Int $) is cached { * }, but that's not obvious from the error message. I'm not sure if this happens with other Routine traits, but I wouldn't be surprised.
Subject: test.p6
Download test.p6
application/octet-stream 245b

Message body not shown because it is not plain text.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org