Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] GC and file descriptors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] GC and file descriptors
On Fri, 14 Nov 2003, Dmitry Bely wrote:

> close() can fail (generate an exception). How are you going to handle it in
> the garbage collector? On the contrary, the memory deallocaton always
> succeeds.

Two choices: either abort the whole program (uncaught exception), or 
ignore it.  Ocaml's life is a little easier, as GC takes place inside the 
single thread of execution.  But I dislike making the language spec 
require that.  

Now, *which* of those two choices is "correct" is a matter for some 
debate.  Myself, I like aborting the whole program.

What I dislike is resource leaks- as plugging the holes manually can often
be tricky.  If I wanted to hand-manage resource deallocation, I'd be
programming in C (well, not quite- but the point is made).

-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners