Feedback and comments on ARM proposal
Florian Weimer
fw at deneb.enyo.de
Sat Mar 21 10:00:10 PDT 2009
* Joshua Bloch:
> I think it might be easier to specify (and implement the package variant.
> Roughly speaking, the legal types for "manageable resources" are those that
> are assignment compatible with one and only one of the classes in
> java.lang.auto. While it's not generally possible to enumerate over classes
> in a package, the compiler can be (are, in fact) tied to particular versions
> of the platform so this shouldn't present too big a problem (though it could
> limit extensibility by JRE hackers).
If the interface has to reside in a package java.lang.auto.disposer,
you could name the interface by the name of the method, and generate
implementations automatically. For instance,
java.lang.auto.disposer.foo would behave as if it were implemented as
package java.lang.auto.disposer;
public interface foo {
foo() throws Exception;
}
java.io.Closeable would look like this:
package java.io;
import java.io.IOException;
public interface Closeable extends java.lang.auto.disposer.close {
public void close() throws IOException;
}
If some other language mechanism eventually made this obsolete, those
generated interfaces could likely incorporate this mechanism
automatically.
But perhaps this is too cute (but I think similar approaches where
proposed to deal with tuples).
More information about the coin-dev
mailing list