Version française
Home     About     Download     Resources     Contact us    
Browse thread
exception safety / RAII ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Re: exception safety / RAII ?
On Tue, Mar 08, 2005 at 01:33:12PM +0200, Ville-Pertti Keinonen wrote:
> IMHO currently the closest to the "best of both worlds" is a good
> garbage collector (with non-deterministic finalization) and explicit
> management for those resources that need them (file handles are a good
> example; in addition to the reasons already mentioned in this thread,
> also because they may refer to sockets and to avoid running into file
> descriptor limits).

I think it'd be nice to have both finalisation and destructors when a
local variable goes out of scope.  You might need to mark variables
specially to indicate that those (and only those) should be reference
counted.  I understand that the implementation would be non-trivial.
Perhaps:

  val open_in : string -> in_channel refcounted

There was a great paper I read about a year ago all about how
finalisation and destruction are completely separate concepts.
Unfortunately I can't find it now ...

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com