Skip to content

Parametric types with traits #81

@gdalle

Description

@gdalle

Is it possible to define parametric types with SimpleTraits.jl?
The package documentation shows examples like

@traitfn f(x::X) where {X; IsNice{X}} = "Very nice!"
@traitfn f(x::X) where {X; !IsNice{X}} = "Not so nice!"

but I have yet to see the same for parametric types. What I'm looking for is something like

@traitstruct MyType{X} where {X; IsNice{X}} end

Does this syntax exist somewhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions