Creating custom type of enumerations of symbols

I don’t think this has been suggestedin this thread.

When I wanted an enumerated type I used singleton types with a common supertype:

abstract type DrawingMode end
struct Outline <: DrawingMode end
struct Fill<: DrawingMode end

function circle(something, ::Fill)
    ...
end

circle(stuff, Fill())
1 Like

Yes, that’s the canonical way of doing this. Too bad nobody suggested it when OP made their post in 2018. :slight_smile: