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: skaller <skaller@o...>
Subject: Re: [Caml-list] GC and file descriptors
On Sun, 2003-11-16 at 02:56, Ville-Pertti Keinonen wrote:
> On Sun, Nov 16, 2003 at 01:16:08AM +1100, skaller wrote:
> 
> > It is possible to modify the Ocaml collector to make finalisation
> > orderly, but it is very expensive. It is also possible
> 
> Not just expensive, more like something you definitely don't want to
> even try.  Python tries to have deterministic finalization, but
> falls back on "normal" garbage collection for containers 

Funny, but I actually *needed* deterministic finalisation. 
And the reason was .. I was implementing a Python interpreter
in Ocaml, and needed to emulate Python's ref counting.
But I didn't want to actually do any ref counting :-)

Because of this problem, my own major Python program
interscript would not run on my interpreter, since
it relied on orderly finalisation.

The reason for *that* is that it effectively executed
commands written by the client, and the specification
provided for opening and writing to files, but
not for closing them. Closing files was important
and had to be correctly timed: for example, closing
the main document actually generated the table of
contents (since only at the end are all the contents
known).

Anyhow .. there do exist cases where explicit finalisation
is difficult. This was one of them (and was one of
the main reasons I abandoned the project -- lack of support
for stackless operation was the other).


-------------------
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