Note that there are some explanatory texts on larger screens.

plurals
  1. USAlvin Thompson
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. CO@Paul - I'll admit that sometimes my head spins when thinking about some of the more nuanced aspects of generics, but what advantage does this form have over my original solution? It does not address the problem I asked about. The client code (extending class) syntax is exactly the same, and if anything the superclass appears even more confusing. It does not appear (to my spinning head) to be any more type-safe. I also mentioned in the comment that you could craft a class that was comparable to another class, but as I said I'm not worried about people going out of their way to write garbage.
      singulars
    2. CO@jahroy - Normally I'd agree, but I oversimplified my use case a bit to make my head spin less when phrasing the question. Suffice it to say that extenders of the superclass will have little reason to add any additional functionality to the concrete classes--the concrete classes are normally completely empty. The sole purpose of creating the subclasses is to create different categories of the same thing, with different types. Because of this it makes sense to implement Comparable in the superclass, so extenders of the superclass need not do anything.
      singulars
    3. CO@jahroy - that's not the same thing; in that case the concrete class is implementing Comparable. If anything, that's an argument that Comparable should be implemented by the concrete classes, not evidence that this is impossible.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload