Skip Menu |
Report information
Id: 78234
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [BUG] Declaring a sub in a given block makes calling the sub emit silly errors in Rakudo
Date: Wed, 6 Oct 2010 00:38:12 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 757b
<masak> rakudo: given $_ { sub foo($text) { $text }; say foo($_) } <p6eval> rakudo 2ee5db: OUTPUT«Too many positional parameters passed; got 1 but expected 0 [...] <jnthn> masak: Something looks rotten there. <masak> rakudo: sub foo($text) { $text }; given $_ { foo($_) } <p6eval> rakudo 2ee5db: ( no output ) <masak> rakudo: sub foo($text) { $text }; given $_ { say foo($_) } <p6eval> rakudo 2ee5db: OUTPUT«Any()␤» <jnthn> oh <jnthn> leaky contextual? <masak> jnthn: no idea. <jnthn> Feels lajk. * masak submits rakudobug <jnthn> masak++ <masak> rakudo: given $_ { sub foo($text) { $text }; say foo() } <p6eval> rakudo 2ee5db: OUTPUT«Too many positional parameters passed; got 1 ut expected 0 [...] <masak> there's just no way to please this error.
On Tue Oct 05 15:38:33 2010, masak wrote: Show quoted text
> <masak> rakudo: given $_ { sub foo($text) { $text }; say foo($_) } > <p6eval> rakudo 2ee5db: OUTPUT«Too many positional parameters passed; > got 1 but expected 0 [...] > <jnthn> masak: Something looks rotten there. > <masak> rakudo: sub foo($text) { $text }; given $_ { foo($_) } > <p6eval> rakudo 2ee5db: ( no output ) > <masak> rakudo: sub foo($text) { $text }; given $_ { say foo($_) } > <p6eval> rakudo 2ee5db: OUTPUT«Any()␤» > <jnthn> oh > <jnthn> leaky contextual? > <masak> jnthn: no idea. > <jnthn> Feels lajk. > * masak submits rakudobug > <jnthn> masak++ > <masak> rakudo: given $_ { sub foo($text) { $text }; say foo() } > <p6eval> rakudo 2ee5db: OUTPUT«Too many positional parameters passed; > got 1 ut expected 0 [...] > <masak> there's just no way to please this error.
The above analysis is a little bit off. After rediscovering the bug, this is the golfing of it that I got: $ perl6 -e 'given 0 { sub a {} }' Too many positional parameters passed; got 1 but expected 0 in main program body at line 1
works now, and tested in given.t


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