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

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

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



To: rakudobug [...] perl.org
Subject: [BUG] Can't store whole 1&2 junctions in Mu-keyed hash in Rakudo
From: Carl Mäsak <cmasak [...] gmail.com>
Date: Tue, 14 Jul 2015 21:29:07 +0200
Download (untitled) / with headers
text/plain 405b
<jnthn> my %h{Mu}; # now you can store objects as keys <jnthn> m: my %xy{Mu}; <camelia> rakudo-moar dd3bcc: ( no output ) <jnthn> Note the keys there are objects, not strings. <moritz> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl <camelia> rakudo-moar ccb41d: OUTPUT«Hash[Any,Mu].new(1 => 3, 2 => 3)␤» <moritz> bug <jnthn> hah...I wonder if the postcircumfix sub is to blame... * masak submits rakudobug
Date: Tue, 14 Jul 2015 22:32:03 -0700
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Subject: Re: [perl #125614] [BUG] Can't store whole 1&2 junctions in Mu-keyed hash in Rakudo
To: "Carl Mäsak (via RT)" <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 2.7k
Show quoted text
> On 14 Jul 2015, at 12:29, Carl Mäsak (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by "Carl Mäsak" > # Please include the string: [perl #125614] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=125614 > > > > <jnthn> my %h{Mu}; # now you can store objects as keys > <jnthn> m: my %xy{Mu}; > <camelia> rakudo-moar dd3bcc: ( no output ) > <jnthn> Note the keys there are objects, not strings. > <moritz> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl > <camelia> rakudo-moar ccb41d: OUTPUT«Hash[Any,Mu].new(1 => 3, 2 => 3)␤» > <moritz> bug > <jnthn> hah...I wonder if the postcircumfix sub is to blame... > * masak submits rakudobug
Some more tests: [22:14:53] <lizmat> Looking at #125614 now: [22:15:02] <lizmat> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl # wrong [22:15:02] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(1 => 3, 2 => 3)␤» [22:15:25] <lizmat> m: my %xy{Mu}; %xy.AT-KEY(1&2) = 3; say %xy.perl # is this right? [22:15:25] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» [22:15:43] <lizmat> m: my %xy{Mu}; %xy.ASSIGN-KEY(1&2,3); say %xy.perl # is this right? [22:15:43] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» [22:16:20] <lizmat> m: my %xy{Mu}; %xy.BIND-KEY(1&2,3); say %xy.perl # and this? [22:16:21] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» [22:17:53] <ShimmerFairy> Hm. Unless there's something in the specs stating otherwise, I'd think %xy{1&2} = 3 would make 1 => 3, 2 => 3 , since it is a Junction [22:17:53] <lizmat> m: my %xy{Any}; %xy{1&2} = 3; say %xy.perl # and this? [22:17:53] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Any].new(1 => 3, 2 => 3)␤» [22:17:57] <ShimmerFairy> m: sub foo($a) { say $a }; foo(1&2) [22:17:58] <+camelia> rakudo-moar 8957fc: OUTPUT«1␤2␤» [22:18:18] <ShimmerFairy> ^ that's my reason for thinking {1&2} is the one doing the right thing. [22:18:58] <lizmat> not if it is a typed hash with Mu: then the autothreading should not work (is what conception of the problem is) [22:20:58] <ShimmerFairy> Oh, I see. Well, I think in that case it should be any(1, 2) => 3 , since the Junction is the key (I don't think all(1 => 3, 2 => 3) is right, and I don't see how it could be immediately) So, assuming AT-KEY is doing the right thing, and looking at the circumfix {} code: multi sub postcircumfix:<{ }>( \SELF, \key ) is rw { SELF.AT-KEY(key); } Since we bind the key value to what is being passed to AT-KEY, and AT-KEY is doing the right thing, I can only assume there is something screwy going on with “is rw”. And that is going right into the bowels, and I’m out of my league :-) Hope this helps. Liz
Still reproducible (2017.11, HEAD(5929887))

On 2015-07-14 22:32:47, elizabeth wrote:
Show quoted text
>
> > On 14 Jul 2015, at 12:29, Carl Mäsak (via RT) <perl6-bugs-
> > followup@perl.org> wrote:
> >
> > # New Ticket Created by "Carl Mäsak"
> > # Please include the string: [perl #125614]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: https://rt.perl.org/Ticket/Display.html?id=125614 >
> >
> >
> > <jnthn> my %h{Mu}; # now you can store objects as keys
> > <jnthn> m: my %xy{Mu};
> > <camelia> rakudo-moar dd3bcc: ( no output )
> > <jnthn> Note the keys there are objects, not strings.
> > <moritz> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl
> > <camelia> rakudo-moar ccb41d: OUTPUT«Hash[Any,Mu].new(1 => 3, 2 =>
> > 3)␤»
> > <moritz> bug
> > <jnthn> hah...I wonder if the postcircumfix sub is to blame...
> > * masak submits rakudobug
>
> Some more tests:
> [22:14:53] <lizmat> Looking at #125614 now:
> [22:15:02] <lizmat> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl #
> wrong
> [22:15:02] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(1
> => 3, 2 => 3)␤»
> [22:15:25] <lizmat> m: my %xy{Mu}; %xy.AT-KEY(1&2) = 3; say
> %xy.perl # is this right?
> [22:15:25] <+camelia> rakudo-moar 8957fc:
> OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤»
> [22:15:43] <lizmat> m: my %xy{Mu}; %xy.ASSIGN-KEY(1&2,3); say
> %xy.perl # is this right?
> [22:15:43] <+camelia> rakudo-moar 8957fc:
> OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤»
> [22:16:20] <lizmat> m: my %xy{Mu}; %xy.BIND-KEY(1&2,3); say
> %xy.perl # and this?
> [22:16:21] <+camelia> rakudo-moar 8957fc:
> OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤»
> [22:17:53] <ShimmerFairy> Hm. Unless there's something in the
> specs stating otherwise, I'd think %xy{1&2} = 3 would make 1 => 3, 2
> => 3 , since it is a Junction
> [22:17:53] <lizmat> m: my %xy{Any}; %xy{1&2} = 3; say %xy.perl #
> and this?
> [22:17:53] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Any].new(1
> => 3, 2 => 3)␤»
> [22:17:57] <ShimmerFairy> m: sub foo($a) { say $a }; foo(1&2)
> [22:17:58] <+camelia> rakudo-moar 8957fc: OUTPUT«1␤2␤»
> [22:18:18] <ShimmerFairy> ^ that's my reason for thinking {1&2}
> is the one doing the right thing.
> [22:18:58] <lizmat> not if it is a typed hash with Mu: then the
> autothreading should not work (is what conception of the problem is)
> [22:20:58] <ShimmerFairy> Oh, I see. Well, I think in that case
> it should be any(1, 2) => 3 , since the Junction is the key (I don't
> think all(1 => 3, 2 => 3) is right, and I don't see how it could be
> immediately)
>
> So, assuming AT-KEY is doing the right thing, and looking at the
> circumfix {} code:
>
> multi sub postcircumfix:<{ }>( \SELF, \key ) is rw {
> SELF.AT-KEY(key);
> }
>
> Since we bind the key value to what is being passed to AT-KEY, and AT-
> KEY is doing the right thing, I can only assume there is something
> screwy going on with “is rw”. And that is going right into the
> bowels, and I’m out of my league :-)
>
>
> Hope this helps.
>
>
>
> Liz


RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 3.8k
On Tue, 14 Jul 2015 22:32:47 -0700, elizabeth wrote: Show quoted text
>
> > On 14 Jul 2015, at 12:29, Carl Mäsak (via RT) <perl6-bugs- > > followup@perl.org> wrote: > > > > # New Ticket Created by "Carl Mäsak" > > # Please include the string: [perl #125614] > > # in the subject line of all future correspondence about this issue. > > # <URL: https://rt.perl.org/Ticket/Display.html?id=125614 > > > > > > > <jnthn> my %h{Mu}; # now you can store objects as keys > > <jnthn> m: my %xy{Mu}; > > <camelia> rakudo-moar dd3bcc: ( no output ) > > <jnthn> Note the keys there are objects, not strings. > > <moritz> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl > > <camelia> rakudo-moar ccb41d: OUTPUT«Hash[Any,Mu].new(1 => 3, 2 => > > 3)␤» > > <moritz> bug > > <jnthn> hah...I wonder if the postcircumfix sub is to blame... > > * masak submits rakudobug
> > Some more tests: > [22:14:53] <lizmat> Looking at #125614 now: > [22:15:02] <lizmat> m: my %xy{Mu}; %xy{1&2} = 3; say %xy.perl # > wrong > [22:15:02] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Mu].new(1 > => 3, 2 => 3)␤» > [22:15:25] <lizmat> m: my %xy{Mu}; %xy.AT-KEY(1&2) = 3; say > %xy.perl # is this right? > [22:15:25] <+camelia> rakudo-moar 8957fc: > OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» > [22:15:43] <lizmat> m: my %xy{Mu}; %xy.ASSIGN-KEY(1&2,3); say > %xy.perl # is this right? > [22:15:43] <+camelia> rakudo-moar 8957fc: > OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» > [22:16:20] <lizmat> m: my %xy{Mu}; %xy.BIND-KEY(1&2,3); say > %xy.perl # and this? > [22:16:21] <+camelia> rakudo-moar 8957fc: > OUTPUT«Hash[Any,Mu].new(all(1 => 3, 2 => 3))␤» > [22:17:53] <ShimmerFairy> Hm. Unless there's something in the > specs stating otherwise, I'd think %xy{1&2} = 3 would make 1 => 3, 2 > => 3 , since it is a Junction > [22:17:53] <lizmat> m: my %xy{Any}; %xy{1&2} = 3; say %xy.perl # > and this? > [22:17:53] <+camelia> rakudo-moar 8957fc: OUTPUT«Hash[Any,Any].new(1 > => 3, 2 => 3)␤» > [22:17:57] <ShimmerFairy> m: sub foo($a) { say $a }; foo(1&2) > [22:17:58] <+camelia> rakudo-moar 8957fc: OUTPUT«1␤2␤» > [22:18:18] <ShimmerFairy> ^ that's my reason for thinking {1&2} > is the one doing the right thing. > [22:18:58] <lizmat> not if it is a typed hash with Mu: then the > autothreading should not work (is what conception of the problem is) > [22:20:58] <ShimmerFairy> Oh, I see. Well, I think in that case > it should be any(1, 2) => 3 , since the Junction is the key (I don't > think all(1 => 3, 2 => 3) is right, and I don't see how it could be > immediately) > > So, assuming AT-KEY is doing the right thing, and looking at the > circumfix {} code: > > multi sub postcircumfix:<{ }>( \SELF, \key ) is rw { > SELF.AT-KEY(key); > } > > Since we bind the key value to what is being passed to AT-KEY, and AT- > KEY is doing the right thing, I can only assume there is something > screwy going on with “is rw”. And that is going right into the > bowels, and I’m out of my league :-) > > > Hope this helps. > > > > Liz
I managed to fix[^1] this, though almost immediately using Junctions as keys caused Map.sort to blow up. I fixed[^2] that too, but not sure what other crucial methods explode due to Junction keys. I aborted spectest when multiple failures occurred; not due to my fix, but rather due to RT#128905[^3]. I've no idea how to fix that ticket, so I've stashed my work for this ticket into fix-Hash-Mu-keys--RT-1357201 branch[^4] for now. It still needs a full spectest run before merge, once RT#128905 is fixed. [1] https://github.com/rakudo/rakudo/commit/a5cf61c905ca6a80f7c35bb47aff1a67390a2943 [2] https://github.com/rakudo/rakudo/commit/a5cf61c905ca6a80f7c35bb47aff1a67390a2943 [3] https://rt.perl.org/Ticket/Display.html?id=128905#txn-1516048 [4] https://github.com/rakudo/rakudo/tree/fix-Hash-Mu-keys--RT-1357201


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