Proposal: Automatic Resource Management (original) (raw)
Tim Peierls tim at peierls.net
Wed Mar 4 14:40:16 PST 2009
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]