Skip to content

Instantly share code, notes, and snippets.

@genio genio/current_events.md
Last active May 3, 2017

Embed
What would you like to do?
Perl 5 Async and Await

Future::AsyncAwait

Notable Links:

Purpose:

This will be a living document that will get updated every Thursday evening to account for any contributions or advancements made on the project until it is no longer deemed necessary.

How to Contribute:

  1. Read through the questions and comments posed here.
  2. Research and help find documentation or answers for any of the questions posed here.
  3. Provide use cases (good edge cases, etc.) to test against BANANA example

You can respond with comments here, emails directly to Paul Evans, RT tickets, IRC chat, or really, any other method of communication you like.

Anyway that you can find to contribute to the project would be appreciated.

Questions that need answering:

  1. How do you communicate context (list/scalar/void) into an async sub?
  2. Do you make effort to preserve @_ over an await pause? (consider signatures)
  3. How should local behave around async/await deferral?
  • our $x = 1; async sub { local $x = 2; await $F; say $x } Should print 2?

TODOs:

  • Implement await on non-ready Futures
    • static OP *pp_await(pTHX)
      • suspend the sub by making it return a new (unready) future
      • When the awaiting future becomes ready, the suspended sub will now resume, carrying on where it left off because now the await expression returns, and the sub continues
  • Forbid the use of the await keyword outside of an async sub
    • static int await_keyword_plugin(pTHX_ OP **op_ptr)

2017-04-27 Update

  1. One RT was entered to fix dependencies. Will be remedied soon.
  2. A few attempts to implement await on non-ready Futures were made but a working solution is yet to present itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.