PROPOSAL: Abstract enums (version 2)

Tom Hawtin Thomas.Hawtin at Sun.COM
Mon May 11 04:25:48 PDT 2009


Howard Lovatt wrote:
> Yes a single element enum is a great singleton. Instead of:

"Great singleton" is probably an oxymoron.

> enum Singleton {
>   // No INSTANCE
>   void method() { ... }
>   ...
> }

I think for grammatical reasons you'll need to retain the semicolon.

> Usage:
> 
> Singleton.method();

If you add static to the method declaration, you are already there. Of 
couse still have the problem that you have introduced a load of 
inappropriate methods via enum.

Tom Hawtin



More information about the coin-dev mailing list