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

Owner: Nobody
Requestors: FROGGS.de <email [at] froggs.de>
Cc:
AdminCc:

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



Date: Wed, 14 Jan 2015 12:05:08 +0100
To: rakudobug [...] perl.org
From: Tobias Leich <email [...] froggs.de>
Subject: vars from subsigs are not available to where blocks
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
Interesting. Still reproducible (2017.11, HEAD(5929887))

On 2015-01-14 03:05:38, FROGGS.de wrote:
Show quoted text
> 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




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