PROPOSAL: Static Methods in Interfaces (v1.1)

Josh Suereth joshua.suereth at gmail.com
Thu Mar 19 04:46:53 PDT 2009


On Thu, Mar 19, 2009 at 3:30 AM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> Why do you feel waiting is a better idea?
>
> Unless you have some sort of language improvement in mind which is
> going to become impossible if SMI is added, I'd argue the reverse:
> Bigger changes should be introduced in bits and pieces if each piece
> is individually useful.
>
>  --Reinier Zwitserloot
>
>
While I'd argue that extension methods are useful (although something
slightly more powerful like scala implicit conversions may be a better
idea), I'm not 100% sold on static methods on interfaces.  I do think it's a
great idea for alternative JVM languages who *are* defining traits using a
combination of interfaces + static methods.  So, in this case I'd love to
see this in the JVM, but not sure I would use it from the Java language
itself until it became more useful (i.e. full out traits).

To the argument against by virtue of "This would be harder to use in
applets", I would apply the same caution to any language feature: "Don't
abuse it".  Obviously some third-party jars would potentially do so that you
want to make use of, however tools like proguard or jarjar could potentially
have options to remove unused methods from classes when "minifying" your
distro (assuming no reflection is used).  I don't think any feature should
be allowed/denied on the basis of abuse.   I can still synchronize("hello")
{} all day long in java.



More information about the coin-dev mailing list