Is multiple dispatch possible for an enumerated type?

Hello, is multiple dispatch possible for an enumerated type ?

my version:

@enum Foo M=1 N=2
Bar(x) = Bar(Val(x))
Bar(::Val{M}) = 111
Bar(::Val{N}) = 222

Possible, but perhaps not desirable. See

1 Like

Does the same apply for SumTypes.jl too?

2 Likes

Take a look at WhereTraits.jl or even MLStyle.jl @switch, for example.

1 Like