Proposal: Automatic Resource Management

Tim Peierls tim at peierls.net
Wed Mar 4 14:40:16 PST 2009


I've never understood the fervor with which Java is defended from
annotations that can change program semantics; the defenders' arguments
always sound suspiciously circular. But never mind that ... I confess that
even though I would have been happy with

    @Finally public void release() { ... }

I'd much prefer

    public finally void release() { ... }

If, as I fear, neither of these are ultimately found palatable, then
Disposable.close() may have to do -- it might be restricted to solving a
smaller problem than I'd hoped, but that's still an important problem to
solve.

--tim


On Wed, Mar 4, 2009 at 4:45 PM, Mark Mahieu <markmahieu at googlemail.com>wrote:

> Putting interfaces aside for a moment, instead of an annotation my
> instinct would have been to reach for a modifier here, especially
> given that this proposal is for dedicated language support rather
> than a library based solution.  There's even one reserved word
> already that conveys the meaning pretty well:
>
> class SomeResourceType {
>
>        public finally void release() {
>                // ...
>        }
> }
>
>
> That approach may well raise all sorts of questions as well - I can
> certainly think of a couple - but compared to using an annotation,
> what's wrong with it?



More information about the coin-dev mailing list