From f57427b14052847415032c7d28e443710b6ceaf9 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Mon, 22 Dec 2014 19:10:57 +0100 Subject: [PATCH 1/3] Simplify Supply.list --- src/core/Supply.pm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/Supply.pm b/src/core/Supply.pm index 795196b48b1..f465340a398 100644 --- a/src/core/Supply.pm +++ b/src/core/Supply.pm @@ -153,13 +153,7 @@ my role Supply { method list(Supply:D:) { # Use a Channel to handle any asynchrony. - my $c = self.Channel; - map sub ($) { - earliest $c { - more * { $_ } - done * { last } - } - }, *; + self.Channel.list; } method on_demand(Supply:U: |c) { SupplyOperations.on_demand(|c) } From 828d0df4e7793d12d3526c40c962b964907b1061 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Mon, 22 Dec 2014 23:09:33 +0100 Subject: [PATCH 2/3] Deprecate Supply.for in favour of .from-list --- src/core/Supply.pm | 7 ++++++- src/core/SupplyOperations.pm | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/Supply.pm b/src/core/Supply.pm index f465340a398..795f19dfc22 100644 --- a/src/core/Supply.pm +++ b/src/core/Supply.pm @@ -156,8 +156,13 @@ my role Supply { self.Channel.list; } + method for(Supply:U: |c) { + DEPRECATED('from-list',|<2015.01 2016.01>); + SupplyOperations.from-list(|c); + } + method on_demand(Supply:U: |c) { SupplyOperations.on_demand(|c) } - method for(Supply:U: |c) { SupplyOperations.for(|c) } + method from-list(Supply:U: |c) { SupplyOperations.from-list(|c) } method interval(Supply:U: |c) { SupplyOperations.interval(|c) } method flat(Supply:D: ) { SupplyOperations.flat(self) } method grep(Supply:D: Mu $test) { SupplyOperations.grep(self, $test) } diff --git a/src/core/SupplyOperations.pm b/src/core/SupplyOperations.pm index 8f2a2db43e9..548cf881ea4 100644 --- a/src/core/SupplyOperations.pm +++ b/src/core/SupplyOperations.pm @@ -69,8 +69,8 @@ my class SupplyOperations is repr('Uninstantiable') { OnDemandSupply.new(:&producer, :&closing, :$scheduler) } - method for(*@values, :$scheduler = CurrentThreadScheduler) { - my class ForSupply does Supply { + method from-list(*@values, :$scheduler = CurrentThreadScheduler) { + my class FromListSupply does Supply { has @!values; has $!scheduler; @@ -93,7 +93,7 @@ my class SupplyOperations is repr('Uninstantiable') { $sub } } - ForSupply.new(:@values, :$scheduler) + FromListSupply.new(:@values, :$scheduler) } method interval($interval, $delay = 0, :$scheduler = $*SCHEDULER) { From d45c53a61bc171d587a85d73d67ee822d7237492 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Mon, 22 Dec 2014 23:12:41 +0100 Subject: [PATCH 3/3] Update ChangeLog for Supply.from-list --- docs/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index c49f66ad77a..200919decea 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -2,6 +2,7 @@ New in 2015.01 + Proper error handling for a placeholder that has already been used as non-placeholder in the same scope + sub form of 'unique' introduced, 'uniq' deprecated ++ Supply.for deprecated in favour of Supply.from-list New in 2014.12 + Flakiness on OS X has been fixed