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

Rakudo doesn't build pairs correctly for :foo[...], :foo<...>, :foo{...} #1103

Closed
p6rt opened this issue Jun 26, 2009 · 14 comments
Closed

Rakudo doesn't build pairs correctly for :foo[...], :foo<...>, :foo{...} #1103

p6rt opened this issue Jun 26, 2009 · 14 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 26, 2009

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

Searchable as RT66996$

@p6rt
Copy link
Author

p6rt commented Jun 26, 2009

From @masak

<masak> rakudo​: my $a = :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]
* masak submits rakuodbug
<masak> rakudo​: :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

From @pmichaud

On Fri Jun 26 07​:56​:40 2009, masak wrote​:

<masak> rakudo​: my $a = :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]
* masak submits rakuodbug
<masak> rakudo​: :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]

What should $a contain in the above case? I.e., what's the
expected/desired value of $a.perl ?

Pm

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

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

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

From @moritz

Patrick R. Michaud via RT wrote​:

On Fri Jun 26 07​:56​:40 2009, masak wrote​:

<masak> rakudo​: my $a = :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]
* masak submits rakuodbug
<masak> rakudo​: :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]

What should $a contain in the above case? I.e., what's the
expected/desired value of $a.perl ?

I think it should be the same as

my $a = x => [];

(that is a pair holding an empty list or array, don't know exactly which).

cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jul 4, 2009

From @masak

<masak> rakudo​: :a()
<p6eval> rakudo 6a4d66​: OUTPUT«Null PMC access in find_method() [...]
* masak submits rakudobug
<masak> hahaa, my smallest one ever! \o/
<jnthn> rakudo​: :a( )
<p6eval> rakudo 6a4d66​: OUTPUT«Null PMC access in find_method() [...]
<masak> rakudo​: :a[] # also
<p6eval> rakudo 6a4d66​: OUTPUT«Null PMC access in find_method() [...]
<jnthn> nice catch

@p6rt
Copy link
Author

p6rt commented Jul 5, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/t/spec/S02-builtin_data_types/pair.t

@p6rt
Copy link
Author

p6rt commented Jul 5, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

From @masak

<masak> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say .kv.perl for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«["bar", ["baz" => 42, "sloth" =>
43]]␤["bar", baz" => 42, "sloth" => 43]␤»
<masak> is this a bug? if so, is it new?
<moritz_> .kv changed recently
<moritz_> today, that is
<masak> it got ported into the setting, no?
<moritz_> yes
<moritz_> so it seems to pick up the one from Any-list.pm
<moritz_> and not the one from Pair
<masak> but surely the spectests would've caught this...
<moritz_> t/spec/S32-array/kv.t still passes.
<masak> then it has too few tests.
<moritz_> rakudo​: my $p = foo => 'bar'; say $p.keys
<p6eval> rakudo 61f269​: OUTPUT«0␤»
<masak> o_O
<moritz_> rakudo​: my $p = foo => 'bar'; say $p.key
<p6eval> rakudo 61f269​: OUTPUT«foo␤»
<moritz_> uhm.
<moritz_> masak​: do you agree that Pair.keys should return the same as Pair.key?
<masak> yes, but possibly in a List.
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say .kv.elems for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«2␤3␤»
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say .perl for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«"bar" => ["baz" => 42, "sloth" =>
43]␤"bar" => ["baz" => 42, "sloth" => 43]␤»
<moritz_> so they are different under the hood, but return the same
.perl output?
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say $x eqv $y
<p6eval> rakudo 61f269​: OUTPUT«1␤»
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; .WHAT.say for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«Pair()␤Pair()␤»
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say kv($_).perl for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«[0, "bar" => ["baz" => 42, "sloth" =>
43]]␤[0, "bar" => ["baz" => 42, "sloth" => 43]]␤»
<moritz_> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; .PARROT.say for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«Perl6Pair␤Perl6Pair␤»
<moritz_> hm, calling @​.values seemed to be not my brightest idea
<masak> moritz_​: I'll submit the bug if you add the test. :)
<moritz_> masak​: ok; I've turned it into 8 tests already
<masak> :)
<moritz_> masak​: somehow I suspect it's a dispatching bugs wrt colon
pair $x = :a; my $y = a => True; say a($x); say a($y)
<p6eval> rakudo 61f269​: OUTPUT«Pair␤Pair␤»
<moritz_> not that easy, it seems :/

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

From @moritz

On Sun Aug 09 14​:31​:17 2009, masak wrote​:

<masak> rakudo​: my $x = bar => [ baz => 42, sloth => 43 ]; my $y =
:bar[ baz => 42, sloth => 43 ]; say .kv.perl for $x, $y
<p6eval> rakudo 61f269​: OUTPUT«["bar", ["baz" => 42, "sloth" =>
43]]␤["bar", baz" => 42, "sloth" => 43]␤»
<masak> is this a bug? if so, is it new?
<moritz_> .kv changed recently
<moritz_> today, that is
<masak> it got ported into the setting, no?
<moritz_> yes

... but it seems to be unrelated to that move.

I unrolled these commits locally​:
$ git revert 75d2b7d2d6e4208bd652d047c23ff826e8bc51b4
Finished one revert.
Created commit 4add137​: Revert "simplify List.kv"
1 files changed, 8 insertions(+), 1 deletions(-)
$ git revert 7d06fad1bb6ed24f3f6cb4ed459daacddd6cfb61
Finished one revert.
Created commit 298cfe5​: Revert "moved kv to setting"
2 files changed, 40 insertions(+), 15 deletions(-)

Then recompiled and ran the new tests, that didn't change anything.

It seems that the :foo[...] colonpair syntax doesn't set up the array
sufficiently non-flattening​:

# correct​: one iteration​:
23​:52 <@​moritz_> rakudo​: for (foo => [3, 4]).value { .say }
23​:52 < p6eval> rakudo 61f269​: OUTPUT«34␤»

# flat list, two iterations (IMHO wrong)​:
23​:52 <@​moritz_> rakudo​: for :foo[3, 4].value { .say }
23​:52 < p6eval> rakudo 61f269​: OUTPUT«3␤4␤»

as I understand .value it should return a scalar, not a list.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 10, 2009

From @pmichaud

On Sun Aug 09 14​:56​:24 2009, moritz wrote​:

It seems that the :foo[...] colonpair syntax doesn't set up the array
sufficiently non-flattening​:

Correct, Rakudo doesn't handle the non-paren colonpair syntaxes yet
(they were recently refactored in STD.pm and haven't caught up). This
ticket is really a duplicate of #​66996, so I'm merging it.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

Seems to work now... leaving open to ensure test coverage

@p6rt
Copy link
Author

p6rt commented Mar 20, 2010

From @moritz

Carl MXXsak (via RT) wrote​:

# New Ticket Created by "Carl Mäsak"
# Please include the string​: [perl #​66996]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=66996 >

<masak> rakudo​: my $a = :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]
* masak submits rakuodbug
<masak> rakudo​: :x[]
<p6eval> rakudo 6c43f9​: OUTPUT«Null PMC access in find_method() [...]

You can now find passing tests in S02-literals/pairs.t.
Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Mar 20, 2010

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

@p6rt p6rt closed this as completed Mar 20, 2010
@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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant