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

vars from subsigs are not available to where blocks #3644

Open
p6rt opened this issue Jan 14, 2015 · 4 comments
Open

vars from subsigs are not available to where blocks #3644

p6rt opened this issue Jan 14, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jan 14, 2015

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

Searchable as RT123596$

@p6rt
Copy link
Author

p6rt commented Jan 14, 2015

From @FROGGS

FROGGS​: m​: multi car($x, [$y, @​ys] where $x == 1) {1}; say car 1, [1,
[2, 3]];
camelia​: rakudo-moar d69491​: OUTPUT«1␤»
FROGGS​: m​: multi car($x, [$y, @​ys] where $x == $y) {1}; say car 1, [1,
[2, 3]];
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»

And also​:
andreoss​: m​: multi car($x, [$y, @​ys] where $x == $y) {1}; say car 1,
[1,2,3];
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
andreoss​: could that be a bug?
moritz​: m​: say 1 == [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«False␤»
moritz​: m​: multi car($x, [$y, *@​ys] where $x == $y) {1}; say car 1, [1,
2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
moritz​: m​: multi car($x, [$y, *@​ys] where { $x == $y }) {1}; say car 1,
[1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
moritz​: huh
moritz​: m​: multi car($x, [$y, *@​ys] where { say (​:$x, :$y).perl; $x ==
$y }) {1}; say car 1, [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => Mu)␤Cannot call
'infix​:<==>'; none of these signatures match​:␤​:(Any $?)␤​:(Any \a, Any
\b)␤​:(Real \a, Real \b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D
\a, Num​:D \b --> Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D…»
moritz​: m​: multi car($x, @​ [$y, *@​ys] where { say (​:$x, :$y).perl; $x
== $y }) {1}; say car 1, [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => Mu)␤Cannot call
'infix​:<==>'; none of these signatures match​:␤​:(Any $?)␤​:(Any \a, Any
\b)␤​:(Real \a, Real \b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D
\a, Num​:D \b --> Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D…»
moritz​: m​: sub f($x, [$y, *@​ys]) { say (​:$x, :$y, :@​ys).perl }; f 1, [2,
3, 4]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => 2, "ys" => [3, 4])␤»
moritz​: m​: sub f($x, [$y, *@​ys] where { say $y.perl } ) { say (​:$x, :$y,
:@​ys).perl }; f 1, [2, 3, 4]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call method 'perl' on a null
object␤ in sub f at /tmp/UT7XBanYbi​:1␤ in block <unit> at
/tmp/UT7XBanYbi​:1␤␤»
moritz​: andreoss​: seems like variables extracted from subsignatures
aren't available in where-blocks
moritz​: andreoss​: and yes, that's a bug

@p6rt
Copy link
Author

p6rt commented Dec 1, 2017

From @AlexDaniel

Interesting. Still reproducible (2017.11, HEAD(5929887))

On 2015-01-14 03​:05​:38, FROGGS.de wrote​:

FROGGS​: m​: multi car($x, [$y, @​ys] where $x == 1) {1}; say car 1, [1,
[2, 3]];
camelia​: rakudo-moar d69491​: OUTPUT«1␤»
FROGGS​: m​: multi car($x, [$y, @​ys] where $x == $y) {1}; say car 1, [1,
[2, 3]];
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»

And also​:
andreoss​: m​: multi car($x, [$y, @​ys] where $x == $y) {1}; say car 1,
[1,2,3];
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
andreoss​: could that be a bug?
moritz​: m​: say 1 == [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«False␤»
moritz​: m​: multi car($x, [$y, *@​ys] where $x == $y) {1}; say car 1, [1,
2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
moritz​: m​: multi car($x, [$y, *@​ys] where { $x == $y }) {1}; say car 1,
[1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call 'infix​:<==>'; none of
these signatures match​:␤​:(Any $?)␤​:(Any \a, Any \b)␤​:(Real \a, Real
\b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D \a, Num​:D \b -->
Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D \a, Rational​:D \b)␤​:(…»
moritz​: huh
moritz​: m​: multi car($x, [$y, *@​ys] where { say (​:$x, :$y).perl; $x ==
$y }) {1}; say car 1, [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => Mu)␤Cannot call
'infix​:<==>'; none of these signatures match​:␤​:(Any $?)␤​:(Any \a, Any
\b)␤​:(Real \a, Real \b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D
\a, Num​:D \b --> Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D…»
moritz​: m​: multi car($x, @​ [$y, *@​ys] where { say (​:$x, :$y).perl; $x
== $y }) {1}; say car 1, [1, 2, 3]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => Mu)␤Cannot call
'infix​:<==>'; none of these signatures match​:␤​:(Any $?)␤​:(Any \a, Any
\b)␤​:(Real \a, Real \b)␤​:(Int​:D \a, Int​:D \b)␤​:(int $a, int $b)␤​:(Num​:D
\a, Num​:D \b --> Bool)␤​:(num $a, num $b --> Bool)␤​:(Rational​:D…»
moritz​: m​: sub f($x, [$y, *@​ys]) { say (​:$x, :$y, :@​ys).perl }; f 1, [2,
3, 4]
camelia​: rakudo-moar d69491​: OUTPUT«("x" => 1, "y" => 2, "ys" => [3, 4])␤»
moritz​: m​: sub f($x, [$y, *@​ys] where { say $y.perl } ) { say (​:$x, :$y,
:@​ys).perl }; f 1, [2, 3, 4]
camelia​: rakudo-moar d69491​: OUTPUT«Cannot call method 'perl' on a null
object␤ in sub f at /tmp/UT7XBanYbi​:1␤ in block <unit> at
/tmp/UT7XBanYbi​:1␤␤»
moritz​: andreoss​: seems like variables extracted from subsignatures
aren't available in where-blocks
moritz​: andreoss​: and yes, that's a bug

@p6rt
Copy link
Author

p6rt commented Dec 1, 2017

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

@AlexDaniel
Copy link
Member

Ref Raku/problem-solving#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants