PROPOSAL: Abstract enums (version 2)

Howard Lovatt howard.lovatt at iee.org
Mon May 11 22:08:22 PDT 2009


Hi Tim,

2009/5/12 Tim Peierls <tim at peierls.net>:
> It just doesn't seem worth the pain of a language change to me. If I were
> ever really at a loss for a name for the singleton instance, I could go
> minimal.
> enum SingletonEnum {
>     _;
>     void method() { System.out.println("method called"); }
>     public static void main(String... args) {
>         SingletonEnum._.method();
>     }
> }
> Or "THE", or "IT". But usually there's a natural name:
> // Socratic singletons
> enum Good { KNOWLEDGE; ... }
> enum Evil { IGNORANCE; ... }

I was probably in your camp until I started to use Scala and I found
the object construct and the concept of a closed set of instances most
useful. Since using a Scala a bit I think the construct is worth
while. Have you used Scala or some other language with this construct?

 -- Howard.



More information about the coin-dev mailing list