-
Notifications
You must be signed in to change notification settings - Fork 21
Description
This continues some of the discussion in #53, esp. #53 (comment). See also JuliaArrays/StructArrays.jl#241 for a PR to use this package in StructArrays.
In StructArrays one generally needs to figure out a type not from fieldvalues (which ConstructionBase can deal with) but from arrays of field values. For example, starting from the type Pair
and the columns [1, 2, 3]
, ["a", "b", 2]
, I would like to figure out that the eltype
for the resulting StructArray
(which should be Pair{Int, Any}
). Could ConstructionBase be extended to support something like this?
There is a second issue in this example. In this Pair{Int, Any}
scenario, the default constructorof
would "lie" about the element type. In other words:
julia> constructorof(Pair{Int, Any})(1, "a") isa Pair{Int, Any}
false
Would it be feasible to add a version of constructorof
that respects the type parameters? Ideally, that would also address #58 as well as other problematic types (such as types with inner constructors).