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

Tap's closing callback doesn't call back #6125

Closed
p6rt opened this issue Mar 4, 2017 · 7 comments
Closed

Tap's closing callback doesn't call back #6125

p6rt opened this issue Mar 4, 2017 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 4, 2017

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

Searchable as RT130920$

@p6rt
Copy link
Author

p6rt commented Mar 4, 2017

From @briandfoy

This is the example from the Tap docs. I expect the output to be
"Tap closed", but I get no output using 2017.01​:

  my $s = Supplier.new;
  my $tap = $s.Supply.tap(
  -> $v { say "the value is $v" },
  done => { say "Supply is done" },
  closing => { say "Tap closed" },
  quit => -> $ex { say "Supply finished with error $ex" },
  );

  # later
  $tap.close;

@p6rt
Copy link
Author

p6rt commented Mar 4, 2017

From @zoffixznet

On Sat, 04 Mar 2017 13​:24​:08 -0800, comdog wrote​:

This is the example from the Tap docs. I expect the output to be
"Tap closed", but I get no output using 2017.01​:

my $s = Supplier\.new;
my $tap = $s\.Supply\.tap\(
    \-> $v \{ say "the value is $v" \},
    done    => \{ say "Supply is done" \},
    closing => \{ say "Tap closed" \},
    quit    => \-> $ex \{ say "Supply finished with error $ex" \},
\);

\# later
$tap\.close;

I don't see `closing` param for that routine​: https://github.com/rakudo/rakudo/blob/b597398/src/core/Supply.pm#L77

Unless this was missed during pre-Christmas Supplies rework, this may be just a doc bug.

@p6rt
Copy link
Author

p6rt commented Mar 4, 2017

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

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

From @jnthn

On Sat, 04 Mar 2017 13​:40​:22 -0800, cpan@​zoffix.com wrote​:

On Sat, 04 Mar 2017 13​:24​:08 -0800, comdog wrote​:

This is the example from the Tap docs. I expect the output to be
"Tap closed", but I get no output using 2017.01​:

my $s = Supplier.new;
my $tap = $s.Supply.tap(
-> $v { say "the value is $v" },
done => { say "Supply is done" },
closing => { say "Tap closed" },
quit => -> $ex { say "Supply finished with error $ex" },
);

# later
$tap.close;

I don't see `closing` param for that routine​:
https://github.com/rakudo/rakudo/blob/b597398/src/core/Supply.pm#L77

Unless this was missed during pre-Christmas Supplies rework, this may
be just a doc bug.

It's a doc bug (and, yes, probably a left-behind from an earlier design). The correct way is using `on-close`. Example​:

my $t = Supply.interval(0.5).on-close({ say "bye" }).tap(&say);
sleep 3;
$t.close

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

From @lizmat

On 8 Mar 2017, at 18​:09, jnthn@​jnthn.net via RT <perl6-bugs-followup@​perl.org> wrote​:

On Sat, 04 Mar 2017 13​:40​:22 -0800, cpan@​zoffix.com wrote​:

On Sat, 04 Mar 2017 13​:24​:08 -0800, comdog wrote​:

This is the example from the Tap docs. I expect the output to be
"Tap closed", but I get no output using 2017.01​:

my $s = Supplier.new;
my $tap = $s.Supply.tap(
-> $v { say "the value is $v" },
done => { say "Supply is done" },
closing => { say "Tap closed" },
quit => -> $ex { say "Supply finished with error $ex" },
);

# later
$tap.close;

I don't see `closing` param for that routine​:
https://github.com/rakudo/rakudo/blob/b597398/src/core/Supply.pm#L77

Unless this was missed during pre-Christmas Supplies rework, this may
be just a doc bug.

It's a doc bug (and, yes, probably a left-behind from an earlier design). The correct way is using `on-close`. Example​:

my $t = Supply.interval(0.5).on-close({ say "bye" }).tap(&say);
sleep 3;
$t.close

I wonder whether these “public” functions should handle / warn about unknown named parameters being passed.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2017

From @dogbert17

On Wed, 08 Mar 2017 13​:25​:56 -0800, elizabeth wrote​:

On 8 Mar 2017, at 18​:09, jnthn@​jnthn.net via RT <perl6-bugs-
followup@​perl.org> wrote​:

On Sat, 04 Mar 2017 13​:40​:22 -0800, cpan@​zoffix.com wrote​:

On Sat, 04 Mar 2017 13​:24​:08 -0800, comdog wrote​:

This is the example from the Tap docs. I expect the output to be
"Tap closed", but I get no output using 2017.01​:

my $s = Supplier.new;
my $tap = $s.Supply.tap(
-> $v { say "the value is $v" },
done => { say "Supply is done" },
closing => { say "Tap closed" },
quit => -> $ex { say "Supply finished with error $ex" },
);

# later
$tap.close;

I don't see `closing` param for that routine​:
https://github.com/rakudo/rakudo/blob/b597398/src/core/Supply.pm#L77

Unless this was missed during pre-Christmas Supplies rework, this
may
be just a doc bug.

It's a doc bug (and, yes, probably a left-behind from an earlier
design). The correct way is using `on-close`. Example​:

my $t = Supply.interval(0.5).on-close({ say "bye" }).tap(&say);
sleep 3;
$t.close

I wonder whether these “public” functions should handle / warn about
unknown named parameters being passed.

The docs have been updated in order to reflect current behavior, see for example​:

https://docs.perl6.org/type/Supply#method_on-close

and

https://docs.perl6.org/type/Tap

Closing issue

@p6rt
Copy link
Author

p6rt commented Jul 9, 2017

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

@p6rt p6rt closed this as completed Jul 9, 2017
@p6rt p6rt added the conc 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