There are also multi-level enums to consider:
(They are not an accepted SIP yet, but it’s hard to argue either proposal is so important that breaking the other is irrelevant, see forum, SIP)
enum Animal:
case enum Mammal:
case Dog, Cat
case enum Bird:
case Sparrow, Pinguin
def foo(x: Animal) = ???
foo(Animal.Mammal.Dog) // Allowed
foo(Mammal.Dog) // Allowed ?
foo(Dog) // Allowed ?
This can be somewhat solved with .. (but it’s very ugly):
enum Animal:
case enum Mammal:
case Dog, Cat
case enum Bird:
case Sparrow, Pinguin
def foo(x: Animal) = ???
foo(Animal.Mammal.Dog) // Allowed
foo(..Mammal.Dog) // Allowed
foo(....Dog) // Allowed ?
// or the following, but it makes less sense
foo(..Dog) // Allowed ?
Maybe # is superior in this regard:
enum Animal:
case enum Mammal:
case Dog, Cat
case enum Bird:
case Sparrow, Pinguin
def foo(x: Animal) = ???
foo(Animal.Mammal.Dog) // Allowed
foo(#Mammal.Dog) // Allowed
foo(##Dog) // Allowed ?
// or the more sensible
foo(#.Mammal.Dog) // Allowed
foo(#.#.Dog) // Allowed ?