From 46483b8495800327e5762221add04bdcb9f25af1 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Fri, 16 Apr 2021 12:35:31 +0200 Subject: [PATCH] Revert "Restore the CachedIterator role" This reverts commit dfae760106dd9a83e785da132f2bc2075fb160eb. Alas, not enough time to check this out before the 2021.4 release. Better luck for the 2021.5 release I hope. --- src/core.c/Iterator.pm6 | 8 -------- src/core.c/Rakudo/Iterator.pm6 | 25 +++---------------------- src/core.c/Seq.pm6 | 4 ---- t/02-rakudo/03-corekeys-6c.t | 1 - t/02-rakudo/03-corekeys-6d.t | 1 - t/02-rakudo/03-corekeys-6e.t | 1 - t/02-rakudo/03-corekeys.t | 1 - t/02-rakudo/04-settingkeys-6c.t | 1 - t/02-rakudo/04-settingkeys-6e.t | 1 - 9 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/core.c/Iterator.pm6 b/src/core.c/Iterator.pm6 index f75e2a3eb37..b906fd104c7 100644 --- a/src/core.c/Iterator.pm6 +++ b/src/core.c/Iterator.pm6 @@ -129,12 +129,4 @@ my role PredictiveIterator does Iterator { method bool-only(--> Bool:D) { self.count-only.Bool } } -# The CachedIterator role is a refinement of the PredictiveIterator role for -# those cases where the source of the iterator is a Positional structure that -# supports the AT-POS interface. With such a structure, there is no need to -# build a separate cache for the PositionalBindFailover functionality. -my role CachedIterator does PredictiveIterator { - method cache(--> Positional:D) { ... } -} - # vim: expandtab shiftwidth=4 diff --git a/src/core.c/Rakudo/Iterator.pm6 b/src/core.c/Rakudo/Iterator.pm6 index 485dba11cc9..5cb2e4b7328 100644 --- a/src/core.c/Rakudo/Iterator.pm6 +++ b/src/core.c/Rakudo/Iterator.pm6 @@ -1702,18 +1702,13 @@ class Rakudo::Iterator { # Returns a sentinel Iterator object that will never generate any value. # Does not take a parameter. - my class Empty does CachedIterator { + my class Empty does PredictiveIterator { method new() { nqp::create(self) } method pull-one(--> IterationEnd) { } method push-all($ --> IterationEnd) { } method sink-all(--> IterationEnd) { } method skip-one(--> 0) { } method skip-at-least($ --> 0) { } - method cache() { - BEGIN nqp::p6bindattrinvres( - nqp::create(List),List,'$!reified',nqp::create(IterationBuffer) - ) - } method count-only(--> 0) { } method bool-only(--> False) { } } @@ -3300,7 +3295,7 @@ class Rakudo::Iterator { # Return an iterator for an Array that has been completely reified # already. Returns a assignable container for elements don't exist # before the end of the reified array. - my class ReifiedArrayIterator does CachedIterator { + my class ReifiedArrayIterator does PredictiveIterator { has $!reified; has $!descriptor; has int $!i; @@ -3376,13 +3371,6 @@ class Rakudo::Iterator { ) ) } - method cache() is raw { - nqp::iseq_i($!i,-1) - ?? nqp::p6bindattrinvres( - nqp::create(List),List,'$!reified',$!reified - ) - !! List.from-iterator(self) - } method count-only(--> Int:D) { nqp::elems($!reified) - $!i - nqp::islt_i($!i,nqp::elems($!reified)) } @@ -3395,7 +3383,7 @@ class Rakudo::Iterator { # Return an iterator for a List that has been completely reified # already. Returns an nqp::null for elements that don't exist # before the end of the reified list. - my class ReifiedListIterator does CachedIterator { + my class ReifiedListIterator does PredictiveIterator { has $!reified; has int $!i; @@ -3464,13 +3452,6 @@ class Rakudo::Iterator { ) ) } - method cache() is raw { - nqp::iseq_i($!i,-1) - ?? nqp::p6bindattrinvres( - nqp::create(List),List,'$!reified',$!reified - ) - !! List.from-iterator(self) - } method count-only(--> Int:D) { nqp::elems($!reified) - $!i - nqp::islt_i($!i,nqp::elems($!reified)) } diff --git a/src/core.c/Seq.pm6 b/src/core.c/Seq.pm6 index e479a429905..555cadb1b0c 100644 --- a/src/core.c/Seq.pm6 +++ b/src/core.c/Seq.pm6 @@ -11,10 +11,6 @@ my class Seq is Cool does Iterable does Sequence { multi method new(Seq: Iterator:D $iter) { nqp::p6bindattrinvres(nqp::create(self),Seq,'$!iter',nqp::decont($iter)) } - # Special handling for CachedIterators, setting the cache up immediately - multi method new(Seq: CachedIterator:D $iter) { - nqp::p6bindattrinvres(nqp::create(self),Seq,'$!list',$iter.cache) - } # This candidate exists purely for being able to EVAL a .raku # representation of a Seq of which the iterator has already been taken, multi method new(Seq:) { nqp::create(self) } diff --git a/t/02-rakudo/03-corekeys-6c.t b/t/02-rakudo/03-corekeys-6c.t index e6e38995b03..8e70d6570ae 100644 --- a/t/02-rakudo/03-corekeys-6c.t +++ b/t/02-rakudo/03-corekeys-6c.t @@ -501,7 +501,6 @@ my @expected = ( Q{Broken}, Q{Buf}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation}, diff --git a/t/02-rakudo/03-corekeys-6d.t b/t/02-rakudo/03-corekeys-6d.t index 5a8dd72ce1a..292f31915b9 100644 --- a/t/02-rakudo/03-corekeys-6d.t +++ b/t/02-rakudo/03-corekeys-6d.t @@ -501,7 +501,6 @@ my @expected = ( Q{Broken}, Q{Buf}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation}, diff --git a/t/02-rakudo/03-corekeys-6e.t b/t/02-rakudo/03-corekeys-6e.t index 777e20f72e1..86d0db12ecd 100644 --- a/t/02-rakudo/03-corekeys-6e.t +++ b/t/02-rakudo/03-corekeys-6e.t @@ -503,7 +503,6 @@ my @expected = ( Q{Broken}, Q{Buf}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation}, diff --git a/t/02-rakudo/03-corekeys.t b/t/02-rakudo/03-corekeys.t index 67fa7c54164..1d319b12f61 100644 --- a/t/02-rakudo/03-corekeys.t +++ b/t/02-rakudo/03-corekeys.t @@ -504,7 +504,6 @@ my @allowed = Q{Broken}, Q{Buf}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation}, diff --git a/t/02-rakudo/04-settingkeys-6c.t b/t/02-rakudo/04-settingkeys-6c.t index 4b767e80e8c..e3fc61d6648 100644 --- a/t/02-rakudo/04-settingkeys-6c.t +++ b/t/02-rakudo/04-settingkeys-6c.t @@ -501,7 +501,6 @@ my %allowed = ( Q{Buf}, Q{CORE-SETTING-REV}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation}, diff --git a/t/02-rakudo/04-settingkeys-6e.t b/t/02-rakudo/04-settingkeys-6e.t index 2fbb8ddd960..49a7e478cf1 100644 --- a/t/02-rakudo/04-settingkeys-6e.t +++ b/t/02-rakudo/04-settingkeys-6e.t @@ -501,7 +501,6 @@ my %allowed = ( Q{Buf}, Q{CORE-SETTING-REV}, Q{CX}, - Q{CachedIterator}, Q{CallFrame}, Q{Callable}, Q{Cancellation},