Dagger.jl
Dagger.jl copied to clipboard
Add closure parsing to at-spawn
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