Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Why does op::via take an ExecutorFactory instead of an `Executor? #24

Description

@brycelelbach

op::via currently takes an ExecutorFactory, which seems somewhat unintuitive to me. Consider the following from composition_2.cpp:

template<class CPUExecutor, class IOExecutor>
void sugar(CPUExecutor cpu, IOExecutor io) {
  // ...

  // f on cpu - g on cpu (explicit: the first cpu task runs f and a second cpu task runs g)
  cpu | 
    op::transform([](auto){ return f(); }) | 
    op::via([cpu]{return cpu;}) | 
    op::transform([](f_t ft) {return g(ft);}) | 
    op::submit([](g_t){});

  // ...
}

In the simple and common case, I have to write something like op::via([cpu]{return cpu;}).

IIUC, cpu is a TimeSingleDeferred here.

Why doesn't op::via just take (some sort of) Deferred? This would be much cleaner IMHO.

Looking at the code, it doesn't seem like anything fancy is done with the ExecutorFactory. It's just used once.

BONUS QUESTION: We move from the ExecutorFactory in this capture, but not in this capture. Why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions