closures after all?

Neal Gafter neal at
Fri Nov 20 14:22:47 PST 2009

On Fri, Nov 20, 2009 at 2:02 PM, Bob Lee <crazybob at> wrote:

> I get it now. My fault. I still prefer the simpler interface-based
> approach.

I distinguish interface-based and pattern-based this way:  An
interface-based specification accepts a value of a particular interface, and
invokes methods defined on that interface.  That is how the for-each loop
works.  A pattern-based specification is defined by source translation,
invoking a method on whatever type results from the translation in each
particular circumstance.

While the current ARM specification requires that the object implement the
AutoCloseable interface, it does not invoke the method from that interface.
The requirement that the value be a subtype of AutoCloseable is not actually
used by the specification.  For example, the specification still makes sense
if AutoCloseable is defined with no methods, or if the requirement is simply
removed from the specification.  The translation is defined in terms of
invoking a method on the actual type of the object to be disposed, not the
interface method on the interface type.  As far as I can tell, ARM is a
pattern-based specification but with an additional requirement that the
value be a subtype of AutoCloseable.

What is the value of that part of the specification that requires the object
be an instance of that particular interface?

More information about the coin-dev mailing list