Pitch: Static and class subscripts

For cases without associated values I can imagine the following to produce a new enum value of that case.

enum Test: Equatable {
  case a
}

Test.Type.self[keyPath: \Test.Type.a] == .a // true

This makes sense and I wondered if that was the idea. People might be confused that it doesn't work for cases with associated values. I guess that gives us an opportunity to explain the relationship between enum cases with factory properties / methods.

1 Like