files & handlers...

From: Benoit de Boursetty (debourse@email.enst.fr)
Date: Sat Feb 05 2000 - 11:37:19 MET

  • Next message: nari: "Extending a list on the OCAML side that is initially allocated on the C side"

    Hi,

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

    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
    Benoît de Boursetty



    This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 10:33:14 MET