Enhanced Enums -- use cases
Brian Goetz
brian.goetz at oracle.com
Fri Apr 28 16:00:26 UTC 2017
> I have examined the uses of Enum in our codebase as best I can. I
> remain skeptical that this feature adds enough value, although the
> ability to use different generic types on each instance would no doubt
> be useful on occasion.
Thanks for your thoughts, Stephen.
The tricky thing about evaluating this feature is that it is more likely
to apply to classes that might like to be enums, but can't currently,
rather than those that already fit within the constraints of enums.
That means the examples are harder to find. Subjectively, I know that I
have encountered that feeling of "GRRR, have to refactor this enum to
classes" when I crossed the line. Of course, this feature won't even
address all of those -- but it will address some.
> What is annoying about the current implementations is the ceremony of
> setting up per instance data.
Good point. This interacts nicely with the planned "data class"
feature; seems likely we can dish some of those goodies to enums at the
same time.
More information about the amber-dev
mailing list