|
|
|
|
|
by steveklabnik
16 days ago
|
|
Depends on what you mean by "safety," what this is really about is open vs closed set. An interface means that there's an open set of things that could be returned, whereas an enum is a closed set. Which one is correct for you depends on your code and requirements. It's true that if you return an open set of things, you'll have to handle cases you didn't explicitly account for. |
|