Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Bidirectional Coroutines #2

Open
nikhedonia opened this issue Oct 29, 2018 · 0 comments
Open

Implement Bidirectional Coroutines #2

nikhedonia opened this issue Oct 29, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@nikhedonia
Copy link
Collaborator

nikhedonia commented Oct 29, 2018

Example:

auto pingPong = [](int x) -> reactor<int, int> {
   while(1) {
     x =  co_yield x;
   }
};

int main() {
  auto actor = pingPong(1);
  auto value = 0;
  while( actor.next(value) ) {
    value = actor.value() + 1;
   }
}

This can be later used to implement:

  • Haskell like io-monads
  • elm like effect systems
  • event-loops
  • parser combinators

PoC: https://godbolt.org/z/AW3UWC

@nikhedonia nikhedonia added the enhancement New feature or request label Oct 29, 2018
@nikhedonia nikhedonia changed the title Implement bidirectional coroutines / channels Implement bidirectional coroutines Oct 29, 2018
@nikhedonia nikhedonia changed the title Implement bidirectional coroutines Implement Bidirectional Coroutines Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant