On Wed, 08 Mar 2017 13:25:56 -0800, elizabeth wrote:
> 
> > On 8 Mar 2017, at 18:09, jn...@jnthn.net via RT <perl6-bugs-
> > follo...@perl.org> wrote:
> >
> > On Sat, 04 Mar 2017 13:40:22 -0800, c...@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

Reply via email to