Skip to content

Refactor traits based on methods #35095

@bramtayl

Description

@bramtayl

All traits which semantically define whether or not a method is expected, e.g. HasShape, HasLength, HasEltype, could be refactored into a single function:

expect_method(::typeof(size), ...)
expect_method(::typeof(length), ...)
expect_method(::typeof(eltype), ...)

which need only take two typed values: True and False. This could unify many existing trait interfaces, and allow them to be more easily combined. In addition, I propose

expect_method(::typeof(getindex), ::Type{Container}, ::Type{Vararg{Int, Dimensions}})
expect_method(::typeof(setindex!), ::Type{Container}, ::Type{Element}, ::Type{Vararg{Int, Dimensions}})

etc. for any method that is required by an Abstract interface.

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