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: Jon Harrop <jon@j...>
Subject: Re: [Caml-list] Re: exception safety / RAII ?
On Monday 07 March 2005 01:32, Stefan Monnier wrote:
> > In most cases you probably won't care when a file is closed after writing
> > to it, so you can just rely on the garbage collector.
>
> Very bad practice in (e.g.) an NFS world where the filesystem makes no
> guarantee about file writes until you actually close the file.

Yes, this may go wrong under certain circumstances (it is not a guarantee) but 
I very rarely have problems with this.

On Monday 07 March 2005 03:31, Michael Walter wrote:
> I'm not sure one should think of it as a "poor man's" solution or an
> "alternative to GC". An indication to that could be the inclusion of
> "using" into C#.

I don't know C#, but when would you want to deallocate a resource before all 
references to it have disappeared?

> Another indication could be the inelegance of 
> finalizers (or as well the trouble people seem to have using them -- I
> wouldn't blame a wrong (read: C++) context as a cause for that).

How are finalisers inelegant? Apart from referencing an object from its own 
finaliser, what problems do people have?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists