Skip to content

Error on anonymous functions with keyword arguments #39

@marius311

Description

@marius311

Looks like serializing functions with keyword arguments doesn't work:

julia> using BSON

julia> f = (;x)->x^2
#7 (generic function with 1 method)

julia> BSON.@save "test.bson" f

julia> BSON.@load "test.bson" f

julia> f(x=2)
ERROR: function #7 does not accept keyword arguments
Stacktrace:
 [1] kwfunc(::Any) at ./boot.jl:330
 [2] top-level scope at none:0

Replacing the above with a positional argument works as expected. Would be great if this could be fixed. I would use JLD2 but while that works with keyword arguments, it can't do closures unlike BSON. I'm on Julia 1.1.0 and BSON 0.2.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions