Rakudo: HyperIterables ignore loop phasers

Created on 22 Oct 2017  Ā·  5Comments  Ā·  Source: rakudo/rakudo

my @a = (^10).list; @a = @a.hyper(:batch(5)).map({ LAST say "last"; ā€žāˆ…ā€œ });
# rakudo-moar d10d69774: ( no output )

# expexted output at the end of a batch:
# last

# FIRST and NEXT are ignored too
# It may be sensible to fail on LAST in a HyperIterable and provide a
# LAST-BATCH phaser to avoid confusion when non-parallel code is
# changed.
NYI hyperace phasers

Most helpful comment

FWIW, I’m making all phasers throw a NYI for the 2017.10 release. So we can figure out semantics until the next release.

On 22 Oct 2017, at 13:21, Wenzel P. P. Peppmeyer notifications@github.com wrote:

my @a = (^10).list; @a = @a.hyper(:batch(5)).map({ LAST say "last"; ā€žāˆ…ā€œ });

rakudo-moar d10d69774: ( no output )

expexted output at the end of a batch:

last

FIRST and NEXT are ignored too

It may be sensible to fail in LAST in a HyperIterable and provide a

LAST-BATCH phaser to avoid confusion when non-parallel code is

changed.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

All 5 comments

FWIW, I’m making all phasers throw a NYI for the 2017.10 release. So we can figure out semantics until the next release.

On 22 Oct 2017, at 13:21, Wenzel P. P. Peppmeyer notifications@github.com wrote:

my @a = (^10).list; @a = @a.hyper(:batch(5)).map({ LAST say "last"; ā€žāˆ…ā€œ });

rakudo-moar d10d69774: ( no output )

expexted output at the end of a batch:

last

FIRST and NEXT are ignored too

It may be sensible to fail in LAST in a HyperIterable and provide a

LAST-BATCH phaser to avoid confusion when non-parallel code is

changed.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

They're simply NYI (which is the case for many things with hyper/race). FIRST should fire on the first element, and LAST on the last element, just as with a non-hyper loop. Batches shouldn't come in to it. The batch with the first element carries a flag indicating that, and it's the same for the batch with the last element. I don't think that we should need to make any guarantee that FIRST will run before iterations in another worker, nor that LAST will run after, since a loop with such order dependencies couldn't be parallelized anyway.

I suspect most situations where a LAST-IN-BATCH could be useful would generally be better done with a race reduce, which will be one of the next race-related things I implement (if nobody beats me to it).

could this issue be considered closed now that it throws a X::NYI?

Yes, thanks for the nudge!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Altai-man picture Altai-man  Ā·  3Comments

AlexDaniel picture AlexDaniel  Ā·  3Comments

eiro picture eiro  Ā·  3Comments

gugod picture gugod  Ā·  3Comments

thundergnat picture thundergnat  Ā·  5Comments