Draft proposal: allow the use of relational operators on Comparable classes (original) (raw)

Joshua Bloch jjb at google.com
Thu Mar 12 12:20:39 PDT 2009


Alex,

Arguably it's a bit too late: the marker (or whatever) should have triggered whether the enum implemented the Comparable interface as well:(

   Josh

On Thu, Mar 12, 2009 at 12:19 PM, Alex Miller <alexdmiller at yahoo.com> wrote:

Kevin Bourrillion <kevinb at google.com> said: > But focusing on enum types sidesteps one set of problems in favor of > another. That being that most user-defined enum types do not actually have > any logical order, and many that seem to have an order do not actually > have that order guaranteed. I would love to have the relational operators on enums...when it makes sense. What if there was a marker interface that your enum could implement? Something like OrderedEnum? I suppose it might be bad form to have the language behavior as to whether something is legal be dependent on a marker interface. But you guys are the experts. Alex



More information about the coin-dev mailing list