Proposal: Automatic Resource Management

Bob Lee crazybob at crazybob.org
Tue Mar 3 19:16:27 PST 2009


On Tue, Mar 3, 2009 at 6:47 PM, Neal Gafter <neal at gafter.com> wrote:

> I guess I assumed you were aware why people complain about
> Closeable.close() throwing IOException.  Josh alluded to this when he
> said that Disposable won't be terribly useful as a parameter type.
> When you pass it somewhere, the receiver must assume that the close()
> method throws any Exception, and that forces the receiver to write
> code to handle the whole Exception hierarchy.  I think it's likely
> that programmers would want to pass a Disposable around so that the
> receiver can put a region of code under control of the resource (i.e.
> dispose it when the receiver arrives at some particular point of
> completion).  I'm afraid this would just be trading one set of pain
> points for another.
>

I think the new Disposable interface will work out very nicely (we could
also name it Resource instead, but that can be left for the EG).

Bob



More information about the coin-dev mailing list