ASDF.jl icon indicating copy to clipboard operation
ASDF.jl copied to clipboard

Type piracy?

Open giordano opened this issue 6 years ago • 1 comments

Aren't

  • https://github.com/eschnett/ASDF.jl/blob/b6a05c2710d84e4704c153456ebd7570f60510b1/src/ASDF.jl#L80
  • https://github.com/eschnett/ASDF.jl/blob/b6a05c2710d84e4704c153456ebd7570f60510b1/src/ASDF.jl#L84 all acts of type piracy?

E.g.

julia> VersionNumber(Dict("major" => 1, "minor" => 2, "patch" => 3, "prerelease" => nothing, "build" => nothing))
ERROR: MethodError: no method matching VersionNumber(::Dict{String,Union{Nothing, Int64}})
Closest candidates are:
  VersionNumber(::UInt32, ::UInt32, ::UInt32, ::Tuple{Vararg{Union{UInt64, String},N} where N}, ::Tuple{Vararg{Union{UInt64, String},N} where N}) at version.jl:33
  VersionNumber(::Integer) at version.jl:61
  VersionNumber(::Integer, ::Integer) at version.jl:61
  ...
Stacktrace:
 [1] top-level scope at none:0

julia> using ASDF

julia> VersionNumber(Dict("major" => 1, "minor" => 2, "patch" => 3, "prerelease" => nothing, "build" => nothing))
v"1.2.3"

giordano avatar Mar 11 '19 01:03 giordano

Yes they are...

I assume ASDF should wrap the items it returns into new types. When ASDF writes, it already uses its own types, but when it reads, it directly returns what PyCall produces. It should convert (wrap) these into respective ASDF types.

eschnett avatar Mar 11 '19 13:03 eschnett