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

Channel.list does not honor .Slip #5720

Open
p6rt opened this issue Oct 3, 2016 · 4 comments
Open

Channel.list does not honor .Slip #5720

p6rt opened this issue Oct 3, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Oct 3, 2016

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

Searchable as RT129797$

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

From @gfldex

my $c = Channel.new;
$c.send((1,2,3).Slip);
$c.close;
dd (1,$c.list,2).join('​:')
# OUTPUT«"1​:1 2 3​:2"␤»
# expected OUTPUT«"1​:1​:2​:3​:2"␤»

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

From @lizmat

On 03 Oct 2016, at 14​:17, Wenzel Peppmeyer (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Wenzel Peppmeyer
# Please include the string​: [perl #​129797]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129797 >

my $c = Channel.new;
$c.send((1,2,3).Slip);
$c.close;
dd (1,$c.list,2).join('​:')
# OUTPUT«"1​:1 2 3​:2"␤»
# expected OUTPUT«"1​:1​:2​:3​:2"␤»

$ 6 'dd (1,(2,3,4),5).join("​:")'
"1​:2 3 4​:5”

would you expect to give that 1​:2​:3​:4​:5 as well?

I think the issue is clouded here by the stringification of a List​:

$ 6 'say (1,2,3).Str'
1 2 3

$ 6 'say ((1,2,3),).Str'
1 2 3

$ 6 'dd (1,2,3)'
(1, 2, 3)

$ 6 'dd ((1,2,3),)'
((1, 2, 3),)

So I’m not sure there *is* a bug here.

Liz

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 4, 2016

From @zoffixznet

If you dump the data with `.perl`, you can see the middle item is a list with the slip in it​:

  <ZoffixW> m​: my $c = Channel.new; $c.send((1,2,3).Slip); $c.close; say (1,$c.list,2).perl
  <camelia> rakudo-moar 2a2f26​: OUTPUT«(1, (slip(1, 2, 3),), 2)␤»
  <ZoffixW> m​: my $c = Channel.new; $c.send((1,2,3).Slip); $c.close; say (1,||||||||||$c.list,2).perl
  <camelia> rakudo-moar 2a2f26​: OUTPUT«(1, slip(1, 2, 3), 2)␤»
  <ZoffixW> m​: my $c = Channel.new; $c.send((1,2,3).Slip); $c.close; say (1,$c.list,2).flat.perl
  <camelia> rakudo-moar 2a2f26​: OUTPUT«(1, 1, 2, 3, 2).Seq␤»

And I think the reported issue is that that doesn't correspond to the behaviour you'd get with a, say, hand-rolled sub doing the same thing, where the slip flattens automagically into an Array, but doesn't do so with the Channel's Queue object​:

  <ZoffixW> m​: sub foo ($x) { my @​foo; @​foo.push​: $x; @​foo.Seq.list }; dd (1, foo((2,3,4).Slip), 2).perl
  <camelia> rakudo-moar 2a2f26​: OUTPUT«"(1, (2, 3, 4), 2)"␤»
  <ZoffixW> m​: sub foo ($x) { my @​foo; @​foo.push​: $x; @​foo.Seq.list }; dd (1, |foo((2,3,4).Slip), 2).perl
  <camelia> rakudo-moar 2a2f26​: OUTPUT«"(1, 2, 3, 4, 2)"␤»

On Mon Oct 03 06​:31​:14 2016, elizabeth wrote​:

On 03 Oct 2016, at 14​:17, Wenzel Peppmeyer (via RT) <perl6-bugs-
followup@​perl.org> wrote​:

# New Ticket Created by Wenzel Peppmeyer
# Please include the string​: [perl #​129797]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129797 >

my $c = Channel.new;
$c.send((1,2,3).Slip);
$c.close;
dd (1,$c.list,2).join('​:')
# OUTPUT«"1​:1 2 3​:2"␤»
# expected OUTPUT«"1​:1​:2​:3​:2"␤»

$ 6 'dd (1,(2,3,4),5).join("​:")'
"1​:2 3 4​:5”

would you expect to give that 1​:2​:3​:4​:5 as well?

I think the issue is clouded here by the stringification of a List​:

$ 6 'say (1,2,3).Str'
1 2 3

$ 6 'say ((1,2,3),).Str'
1 2 3

$ 6 'dd (1,2,3)'
(1, 2, 3)

$ 6 'dd ((1,2,3),)'
((1, 2, 3),)

So I’m not sure there *is* a bug here.

Liz

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

1 participant