Proposal: Automatic Resource Management

Stephen Colebourne jodastephen at gmail.com
Sat Mar 7 10:23:37 PST 2009


Jeremy Manson 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. No changes are possible.

Stephen




More information about the coin-dev mailing list