Skip to content

Allow use of a function/complex object to pick the subtype of an AbstractType? #83

@kshyatt

Description

@kshyatt

Suppose I have a situation like this:

abstract type MyAbs end

struct A <: MyAbs
    id_field::Tuple{String, Int}
    field_a
end

struct B <: MyAbs
    id_field::Tuple{String, Int}
    field_b
end

And I want to dispatch constructing using id_field[1]. I think currently this isn't supported by the NamedTuple approach of StructTypes.subtypes and StructTypes.subtypekey, but would it make sense to extend them to support such cases?

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