Dagger.jl icon indicating copy to clipboard operation
Dagger.jl copied to clipboard

Add closure parsing to at-spawn

Open jpsamaroo opened this issue 2 years ago • 0 comments

This PR brings Dagger.@spawn closer to Threads.@spawn by allowing an alternative parsing mode when begin ... end blocks are encountered; specifically, such blocks are treated as a function without any arguments, which closes over any captured values.

Todo:

  • [ ] Detect closed-over variables (if possible) and pass them as arguments, in case they're thunks/chunks
  • [ ] (Alternative) Recurse into closure at runtime to find thunks/chunks and replace them during move
  • [ ] (Optional) Implement recursive parsing mode
  • [ ] Add tests
  • [ ] Add docs

Fixes #421

jpsamaroo avatar Aug 16 '23 00:08 jpsamaroo