5 ms·
> An enum, short for enumeration, shouldn't hold data, else don't call it an enum. They can in Java. Java's about as mainstream of a programming language as yo
by pcwalton 12y ago
> An enum, short for enumeration, shouldn't hold data, else don't call it an enum.
They can in Java. Java's about as mainstream of a programming language as you can think of.
- taeric 12y agoNot in the same way. In Java, you can have an enum that has some data placed on it, at a per value basis. You can not have an enum where different instances of the same value have different values attached to it. That is, Enum.A will always be Enum.A with the same data on it at all times in Java. This is not the case for ADTs.
- pcwalton 12y agoSure, but having enums with data is not per se out of the ordinary in mainstream languages.