Skip Menu |
Report information
Id: 120838
Status: open
Priority: 0/
Queue: perl6

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

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



Subject: [BUG] LTA error message (on JVM) when passing something to named parameter :$b($c)
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Date: Sat, 21 Dec 2013 12:51:48 +0100
<lizmat_> r: sub a (:$b) {say $b}; a(:b<foo>) # this works <camelia> rakudo-parrot 1049b4, rakudo-jvm 1049b4: OUTPUT«foo␤» <lizmat_> r: sub a (:$b($c)) {say $c}; a(:b<foo>) # this doesn't, but should? <camelia> rakudo-jvm 1049b4: OUTPUT«Flattening named argument must have VMHash REPR␤␤» <camelia> ..rakudo-parrot 1049b4: OUTPUT«Not enough positional parameters passed; got 0 but expected 1 in sub-signature of parameter $b [...] <lizmat_> std: sub a (:$b($c)) {say $c}; a(:b<foo>) <camelia> std 3b262af: OUTPUT«ok 00:01 128m␤» <lizmat_> Am I doing something wrong with the expanded pair syntax as described in [Coke]'s blogpost <masak> r: sub a (:b($c)) {say $c}; a(:b<foo>) <camelia> rakudo-parrot 1049b4, rakudo-jvm 1049b4: OUTPUT«foo␤» <masak> I think the :$b($c) form should either Just Work <masak> or have a much better error message. <masak> (and S06 will probably know which) * masak submits rakudobug <lizmat_> ah, now I see it :-), thanks masak++ <masak> (also, the fact that Rakudo JVM gives something different is suspect in itself) <lizmat_> indeed
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 856b
Status update: It looks like STD's opinion on this has changed: $ viv -c -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' ===SORRY!=== Subsignature not allowed after named parameter; please insert whitespace at (eval) line 1: ------> sub a (:$b⏏($c)) {say $c}; a(:b<foo>) Parse failed Rakudo's error messages are different though: $ perl6-m -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' Too few positionals passed; expected 1 argument but got 0 in sub-signature of parameter $b in sub a at -e:1 in block <unit> at -e:1 $ perl6-p -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' Not enough positional parameters passed; got 0 but expected 1 in sub-signature of parameter $b in sub a at -e:1 in block <unit> at -e:1 $ perl6-j -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' Flattening named argument must have VMHash REPR in sub a at -e:1 in block <unit> at -e:1
Download (untitled) / with headers
text/plain 1.8k
On Fri Oct 17 05:24:14 2014, bartolin@gmx.de wrote: Show quoted text
> Status update: It looks like STD's opinion on this has changed: > > $ viv -c -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' > ===SORRY!=== > Subsignature not allowed after named parameter; please insert > whitespace at (eval) line 1: > ------> sub a (:$b⏏($c)) {say $c}; a(:b<foo>) > Parse failed > > Rakudo's error messages are different though: > > $ perl6-m -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' > Too few positionals passed; expected 1 argument but got 0 in sub- > signature of parameter $b > in sub a at -e:1 > in block <unit> at -e:1 > > $ perl6-p -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' > Not enough positional parameters passed; got 0 but expected 1 in sub- > signature of parameter $b > in sub a at -e:1 > in block <unit> at -e:1 > > $ perl6-j -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' > Flattening named argument must have VMHash REPR > in sub a at -e:1 > in block <unit> at -e:1
Current behavior is as follows: On JVM: psch@hack:~/rakudo/rakudo/install/bin$ ./perl6-j -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' ===SORRY!=== Error while compiling -e Shape declaration with () is reserved; please use whitespace if you meant a subsignature for unpacking, or use the :() form if you meant to add signature info to the function's type at -e:1 ------> sub a (:$b⏏($c)) {say $c}; a(:b<foo>) expecting any of: shape declaration On Moar: psch@hack:~/rakudo/rakudo/install/bin$ ./perl6-m -e 'sub a (:$b($c)) {say $c}; a(:b<foo>)' ===SORRY!=== Error while compiling -e Shape declaration with () is reserved; please use whitespace if you meant a subsignature for unpacking, or use the :() form if you meant to add signature info to the function's type at -e:1 ------> sub a (:$b⏏($c)) {say $c}; a(:b<foo>) expecting any of: shape declaration


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