JuliaParallel / Dagger.jl

A framework for out-of-core and parallel execution
Other
610 stars 66 forks source link

parser: Assorted improvements #533

Closed jpsamaroo closed 3 weeks ago

jpsamaroo commented 3 weeks ago

Uses MacroTools' @capture in the @spawn parser to parse calls, and in the process adds support for do-block syntax and direct calls to anonymous functions:

# Do-block syntax
Dagger.@spawn sum(A) do a
  return a+1
end

# Direct call to anonymous function
Dagger.@spawn A->sum(A; dims=1)+2

This should make it easier for users to apply Dagger.@spawn to arbitrary calls. Note that I am not tackling #514, as that is significantly more difficult to do (it requires finding and transforming all values which might be a DTask).

Fixes #480 Fixes #479 Fixes #421