Proposal: Automatic Resource Management

Stefan Schulz schulz at e-spirit.de
Sat Mar 7 10:15:08 PST 2009


Jeremy Manson wrote:
> try (lock.dlock()) {
>   // ...
> }

The problem with this solution is that lock implements Disposable and 
may be used in the try statement directly, without any error being 
visible at compile time (and maybe non-deterministically failing at 
runtime). The "dlock()" might return a Disposable, but it should at 
least be some wrapper on the lock instance.

Btw., allowing for expressions instead of assignments only is some 
additional syntactic sugar adding a temporary variable for the assignment.

Stefan



More information about the coin-dev mailing list