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.Supply ignores explicit Nil sent on Channel #5159

Closed
p6rt opened this issue Mar 3, 2016 · 5 comments
Closed

Channel.Supply ignores explicit Nil sent on Channel #5159

p6rt opened this issue Mar 3, 2016 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 3, 2016

Migrated from rt.perl.org#127648 (status was 'rejected')

Searchable as RT127648$

@p6rt
Copy link
Author

p6rt commented Mar 3, 2016

From @skids

This should say "got Nil" in there somewhere.

$ perl6 -e 'my $c = Channel.new; my $s = $c.Supply; $s.tap​: { say "got " ~ $_ }; for 1,2,Nil,3 { say "emit " ~ $_.perl; $c.send($_) }; sleep 0.1'
emit 1
emit 2
got 1
emit Nil
got 2
emit 3
got 3

This happens because the Supply code in Channel.pm(line 114 atm) uses .poll and assumes a Nil returned from it requires checking for $!is_closed in the Channel, but, if the Channel is not closed, it does nothing rather than emitting a Nil.

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

Still present in rakudo de5d9e​:

<Zoffix> m​: my $c = Channel.new; my $s = $c.Supply; $s.tap​: { say "got " ~ $_ }; for 1,2,Nil,3 { say "emit " ~ $_.perl; $c.send($_) }; sleep 0.1
<camelia> rakudo-moar de5d9e​: OUTPUT«emit 1␤emit 2␤emit Nil␤got 1␤got 2␤emit 3␤got 3␤»

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

From @zoffixznet

On further inspection, it would appear `Nil` is not a valid value to send through the Channel. For example, `.poll` uses it to signal that there are no values present in the Channel.

--
Cheers,
ZZ | https://twitter.com/zoffix

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

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

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

@zoffixznet - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jul 21, 2016
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