Skip to content

Commit

Permalink
[js] Make .hyper and .race just return the unmodified iterator
Browse files Browse the repository at this point in the history
Most JS VMs lack the threading support needed for that
  • Loading branch information
pmurias committed Mar 24, 2018
1 parent 692d0e3 commit 77c462b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/Iterable.pm6
Expand Up @@ -122,20 +122,30 @@ my role Iterable {

method hyper(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) {
self!valid-hyper-race('hyper', $batch, $degree);
#?if !js
HyperSeq.new:
configuration => HyperConfiguration.new(:$degree, :$batch),
work-stage-head => Rakudo::Internals::HyperIteratorBatcher.new(
iterator => self.iterator
)
#?endif
#?if js
self
#?endif
}

method race(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) {
self!valid-hyper-race('race', $batch, $degree);
#?if !js
RaceSeq.new:
configuration => HyperConfiguration.new(:$degree, :$batch),
work-stage-head => Rakudo::Internals::HyperIteratorBatcher.new(
iterator => self.iterator
)
#?endif
#?if js
self
#?endif
}

sub MIXIFY(\iterable, \type) {
Expand Down

0 comments on commit 77c462b

Please sign in to comment.