Skip to content

Remove ::Function restrictions? #6

@tkf

Description

@tkf

Re:

pforeach(pool, fn::Function, itr)
pforeach(fn::Function, pool, itr)

pmap(pool, fn::Function, itr)
pmap(fn::Function, pool, itr)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions