Proposal: Automatic Resource Management

Neal Gafter neal at gafter.com
Sat Mar 7 10:18:54 PST 2009


On Sat, Mar 7, 2009 at 9:51 AM, Jeremy Manson <jeremy.manson at gmail.com> wrote:
> The "right" fix, if we want to support this pattern, is to allow the
> try resource statement to accept expressions that return Disposables,
> and to retrofit the relevant lock APIs with disposables and lock
> methods that return this:
>
> class Lock implements Disposable {
>  public Lock dlock() {
>    return this;
>  }
>  @Override public void dispose() {
>    unlock();
>  }
> }

Lock is an interface.  Adding methods to an existing interface breaks
compatibility.



More information about the coin-dev mailing list