Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTA error message when passing something to named parameter :$b($c) #3295

Open
p6rt opened this issue Dec 21, 2013 · 5 comments
Open

LTA error message when passing something to named parameter :$b($c) #3295

p6rt opened this issue Dec 21, 2013 · 5 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Dec 21, 2013

Migrated from rt.perl.org#120838 (status was 'open')

Searchable as RT120838$

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 21, 2013

From @masak

<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

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

From @usev6

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

1 similar comment
@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

From @usev6

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

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

@usev6 - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 19, 2015

From @peschwa

On Fri Oct 17 05​:24​:14 2014, bartolin@​gmx.de wrote​:

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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.