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

such a signature with two named parameters save for the sigil is illegal. #2539

Closed
p6rt opened this issue Oct 27, 2011 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Oct 27, 2011

Migrated from rt.perl.org#102362 (status was 'resolved')

Searchable as RT102362$

@p6rt
Copy link
Author

p6rt commented Oct 27, 2011

From @zhuomingliang

JimmyZ perl6​: sub f(​:$x, :&x) { say $x }; f(​:x(min(6,2,3)), :x(1, 2, 3))
p6eval niecza v10-66-g71325b0​: OUTPUT«===SORRY!===␤␤Undeclared routine​:␤ 'min' used at line 1␤␤Potential difficulties​:␤ &x is declared but not used at /tmp/JqYiXINZ05 line 1​:␤------> sub f(​:$x, :⏏&x) { say $x }; f(​:x(min(6,2,3)), :x(1, ␤␤␤Unhandled Excepti…
p6eval ..pugs b927740​: OUTPUT«123␤»
p6eval ..rakudo 158bd0​: OUTPUT«1 2 3␤»
moritz is kinda surprised that it doesn't blow up
JimmyZ perl6​: sub f(​:$x, :$x) { say $x }; f(​:x(min(6,2,3)))
p6eval niecza v10-66-g71325b0​: OUTPUT«===SORRY!===␤␤Undeclared routine​:␤ 'min' used at line 1␤␤Potential difficulties​:␤ Useless redeclaration of variable $x (see line 1) at /tmp/8B3kFxpiJZ line 1​:␤------> sub f(​:$x, :$x⏏) { say $x }; f(​:x(min(6,2,3)))␤␤␤Un…
p6eval ..pugs b927740​: OUTPUT«2␤»
p6eval ..rakudo 158bd0​: OUTPUT«===SORRY!===␤Redeclaration of symbol $x at line 1, near ") { say $x"␤»
JimmyZ thinks it's a bug
masak it is.
masak such a signature with two named parameters save for the sigil is illegal.
masak I remember moritz and me spec'ing the rules for that.
moritz std​: -> :$x, :&x { }
p6eval std be1f10e​: OUTPUT«ok 00​:01 122m␤»
masak STD is lagging
JimmyZ std​: -> :$x, :$x { }
p6eval std be1f10e​: OUTPUT«Potential difficulties​:␤ Useless redeclaration of variable $x (see line 1) at /tmp/FKzWHzu2P5 line 1​:␤------> -> :$x, :⏏$x { }␤ok 00​:01 121m␤»
masak that's too lenient, if you ask me.
masak it's fine for lexicals in general, but not for a siggie.
JimmyZ perl6​: sub f(​:$x, :%x) { say $x };
p6eval pugs b927740, rakudo 158bd0​: ( no output )
p6eval ..niecza v10-66-g71325b0​: OUTPUT«Potential difficulties​:␤ %x is declared but not used at /tmp/UvwYaQgjMv line 1​:␤------> sub f(​:$x, :⏏%x) { say $x };␤ &f is declared but not used at /tmp/UvwYaQgjMv line 1​:␤------> sub f⏏(​:$x, :%x) { say $x };␤␤»…
masak binding is serious business
moritz and signatures are complex beasts
JimmyZ niecza has this bug too

@p6rt
Copy link
Author

p6rt commented Jan 6, 2012

From @jnthn

On Thu Oct 27 08​:42​:00 2011, jimmy.zhuo@​gmail.com wrote​:

JimmyZ perl6​: sub f(​:$x, :&x) { say $x }; f(​:x(min(6,2,3)), :x(1, 2,
3))
p6eval niecza v10-66-g71325b0​: OUTPUT«===SORRY!===␤␤Undeclared
routine​:␤ 'min' used at line 1␤␤Potential difficulties​:␤ &x is
declared but not used at /tmp/JqYiXINZ05 line 1​:␤------> sub f(​:$x,
:⏏&x) { say $x }; f(​:x(min(6,2,3)), :x(1, ␤␤␤Unhandled Excepti…
p6eval ..pugs b927740​: OUTPUT«123␤»
p6eval ..rakudo 158bd0​: OUTPUT«1 2 3␤»
moritz is kinda surprised that it doesn't blow up

Now it's a compile time error.

-> :$x, :&x { }
Name 'x' used for more than one named parameter at line 1, near "{ }\n"

Tagging testneeded.

Thanks,

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 6, 2012

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 14, 2012

From @moritz

We are already passing a test for this in S06-signature/named-parameters.t.

@p6rt
Copy link
Author

p6rt commented Jan 14, 2012

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jan 14, 2012
@p6rt p6rt added the testneeded 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
Development

No branches or pull requests

1 participant