Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
files & handlers...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Benoit de Boursetty <debourse@e...>
Subject: files & handlers...

Here is a naive, user-point-of-view question!

I think we all find the ML language is not tailored to handle file
accesses as they were implemented in current systems, don't we? All of us
wrote some day the following code:

let f = open_in filename in
let temp = input_line f in
close f;

And if you write this:
let f = open_in filename in input_line f;;
(which is more natural to me)
you can never close the file you've opened.

What would the language have to support in order that opened files be
automatically closed when they get out of reach from the program? Is it
what is called "finalization"?

Thanks for your help
Benoit de Boursetty