Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created February 26, 2020 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Whateverable/51c9cfb34de008f55940b03129eae558 to your computer and use it in GitHub Desktop.
Save Whateverable/51c9cfb34de008f55940b03129eae558 to your computer and use it in GitHub Desktop.
quotable6
"Supplier::Preserving"

Is it possible to emit a Failure from a Supplier::Preserving? Calling $s.emit(fail("message")); seems to hang
m: my $s := Supplier::Preserving.new; $s.emit: 42; my $ss = $s.Supply; react whenever $ss {say "here"; done}; $s.emit: 70; react whenever $ss { say "init" }
m: my $s := Supplier::Preserving.new; $s.emit: 42; my $ss = $s.Supply.on-close: {say "closed"}; react whenever $ss {say "here"; last}; say "sending more stuff"; $s.emit: 70; react whenever $ss { say "init" }
m: my $s := Supplier::Preserving.new; $s.emit: 42; my $ss = $s.Supply.on-close: {say "closed"}; react whenever $ss.tap {say "here"; last}; say "sending more stuff"; $s.emit: 70; react whenever $ss { say "init" }
m: my $s := Supplier::Preserving.new; $s.emit: 42; my $ss = $s.Supply.on-close: {say "closed"}; react whenever $ss.tap {say "here"; done}; say "sending more stuff"; $s.emit: 70; react whenever $ss.tap { say "init" }
m: my $s := Supplier::Preserving.new; $s.emit: 42; my $ss = $s.Supply.on-close: {say "closed"}; react whenever $ss.tap {say "here"; done}; say "sending more stuff"; $s.emit: 70; react whenever $ss.tap { say "init: $_" }
m: sub in { my $p = Supplier::Preserving.new; start for 1 .. 10 { .say; $p.emit($_); }; }; react whenever in() { ">$_".say; }
m: sub in { my $p = Supplier::Preserving.new; start for 1 .. 10 { .say; $p.emit($_); }; $p }; react whenever in() { ">$_".say; };
m: my $p = Supplier::Preserving.new; start for ^10 { $p.emit($_); }; react { whenever $p { $_.say; }; whenever Promise.in(2) { done } };
m: sub in { my $p = Supplier::Preserving.new; start { for 1 .. 10 { .say; $p.emit($_); }; $p.done }; $p.Supply }; react whenever in() { ">$_".say; }
¦ doc: gfldex++ created pull request #1609: �doc Supplier::Preserving�
¦ doc: �doc Supplier::Preserving (#1609)�
¦ doc: gfldex++ created pull request #1611: �link to Supplier::Preserving, fixes #1610�
¦ doc: �link to Supplier::Preserving, fixes #1610 (#1611)�
m: class C { has Supplier::Preserving $a .= new}
rakudo-moar 6dd542: OUTPUT«===SORRY!===␤Could not locate compile-time value for symbol Supplier::Preserving␤»
should https://docs.perl6.org/type/Supplier::Preserving be a 404?
I think Supplier::Preserving is just an implementation detail
m: say Supplier::Preserving
So you could try building a version prior to that commit (or just change that Supplier::Preserving back to Supplier and see if the issue goes away). And if it does, we'd need to figure out how to address that commit and the current issue
jnthn, should Supplier::Preserving be tested/documented?
m: Supplier::Preserving.new
|Tux|, a Supplier::Preserving will do that for it's supplys
m: my $a = Supplier::Preserving.new; $a.emit($_) for <a b c d>; $a.done; $a.Supply.tap({ say $_}); # |Tux|
note: there are no hits for Supplier::Preserving on doc.perl6.org
my $sup = Supplier::Preserving.new;
m: my $sub = Supplier::Preserving.from-list((1, 2, 3))
rakudo-moar 7c5472: OUTPUT«Method 'from-list' not found for invocant of class 'Supplier::Preserving'␤ in block <unit> at /tmp/D2GaiJAK1d:1␤␤»
Method 'from-list' not found for invocant of class 'Supplier::Preserving'
m: my $sup = Supplier::Preserving.from-list((1, 2, 3));
rakudo-moar 7c5472: OUTPUT«Method 'from-list' not found for invocant of class 'Supplier::Preserving'␤ in block <unit> at /tmp/tt_wVxeREr:1␤␤»
.tell jnthn my $sup = Supplier::Preserving.from-list((1, 2, 3));
that is when I started to read the commit messgaes and concluded I needed Supplier::Preserving instead
So it could be you need Supplier::Preserving after all.
@i.push: Supplier::Preserving.from-list (@data,);
my $sup = Supplier::Preserving.new.Supply;
rakudo/resupply: Add Supplier::Preserving.
rakudo/resupply: Use Supplier::Preserving in classify/categorize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment