Proposal: Automatic Resource Management
Joshua Bloch
jjb at google.com
Wed Mar 4 19:54:47 PST 2009
Mark,
Hi.
On Wed, Mar 4, 2009 at 7:35 PM, Mark Reinhold <mr at sun.com> wrote:
> > Date: Wed, 04 Mar 2009 16:37:41 -0800
> > From: Joshua Bloch <jjb at google.com>
>
> > It is perhaps worth reiterating that the "finally" (or other keyword)
> > solution really does make things more complex.
>
> Yes, but the complexity might be worthwhile.
Agreed. I wasn't saying that we shouldn't do it; just that we should only
do it with our eyes open.
> On the surface, at least,
> doing this in the language makes a lot more sense to me than doing it
> with an interface.
On the one hand, we did for-each with an interface. But on the other that
was targeted at a more limited set of types, and it was no real hardship
that the method that they had to implement Iterable.
>
> > The superclass of a resource must not be a resource.
>
> Not clear. We could, e.g., allow a superclass to be a resource so long
> as the subclass does not override the disposal method,
Yep. That's what I meant to say, but now what I said. Oops;)
>
> > Remember that Coin means "small change";)
>
> Indeed. Joe might disagree, but to my eye a worked-out proposal for
> keyword-based disposal methods could still meet the threshold of "small
> change".
Well, I'm happy to work it out. Then we'll have two alternatives to
compare.
Regards,
Josh
More information about the coin-dev
mailing list