caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Stefan Monnier" <monnier+lists/caml/news/@tequila.cs.yale.edu>
To: caml-list@inria.fr
Subject: Re: files & handlers...
Date: 07 Feb 2000 10:23:45 -0500	[thread overview]
Message-ID: <5lu2jlghoe.fsf@rum.cs.yale.edu> (raw)
In-Reply-To: <Pine.GSO.4.02.10002051126370.24251-100000@young.enst.fr>

>>>>> "Benoit" == Benoit de Boursetty <debourse@email.enst.fr> writes:
> 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"?

Yes, but it should be avoided if possible because of several
restrictions in its semantics.  For most uses a construct such as

	with_file <name>
	  (fn f => <body>)

will work just as well but with the guarantee that the file will be
closed at a well specified time.


	Stefan "obviously not familiar enough with Caml's syntax"



  reply	other threads:[~2000-02-07 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-05 10:37 Benoit de Boursetty
2000-02-07 15:23 ` Stefan Monnier [this message]
2000-02-07 15:46 ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5lu2jlghoe.fsf@rum.cs.yale.edu \
    --to=monnier+lists/caml/news/@tequila.cs.yale.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).