You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd suggest removing the restriction ::Function from pforeach(fn::Function, pool, itr) etc. since any object in Julia can be a callable. For relevant discussions, see JuliaLang/julia#34296 and JuliaLang/julia#30382. I think this comment by JeffBezanson is a nice summary (emphasis by me):
With multiple dispatch, just as the meaning of a function is important to get consistent, it's also important to get the meanings of the argument slots consistent when possible. It's not ideal for a function to treat an argument in a fundamentally different way based on its type: e.g. "if this is a Function, then call it on pairs of values, otherwise assume it's a container providing the values to use".
This makes having pforeach(pool, fn::Function, itr) a bit an uneasy choice. I think deprecating this method in 1.1 is a reasonable choice.
The text was updated successfully, but these errors were encountered:
This one fell off my radar when I got busy the last few months. I am okay with the above, but how would the compiler differentiate pforeach(pool, fn::Function, itr) from pforeach(fn::Function, pool, itr)? I suppose pool could be typed.
Dispatching on a pool type sounds good to me. But this is tricky so that's why I recommended deprecating pforeach(pool, fn, itr). It's also what Jeff's comment is all about.
Re:
ThreadPools.jl/src/interface.jl
Lines 9 to 10 in 943e831
ThreadPools.jl/src/interface.jl
Lines 47 to 48 in 943e831
I'd suggest removing the restriction
::Function
frompforeach(fn::Function, pool, itr)
etc. since any object in Julia can be a callable. For relevant discussions, see JuliaLang/julia#34296 and JuliaLang/julia#30382. I think this comment by JeffBezanson is a nice summary (emphasis by me):This makes having
pforeach(pool, fn::Function, itr)
a bit an uneasy choice. I think deprecating this method in 1.1 is a reasonable choice.The text was updated successfully, but these errors were encountered: