From: Jon Harrop <jonathandeanharrop@googlemail.com>
To: <orbitz@ezabel.com>
Cc: <caml-list@inria.fr>
Subject: RE: [Caml-list] Scoped Bound Resource Management just for C++?
Date: Wed, 9 Feb 2011 21:50:39 -0000 [thread overview]
Message-ID: <047101cbc8a3$653f1ad0$2fbd5070$@com> (raw)
In-Reply-To: <25000DA4-042A-437D-8082-10C70E1C740F@ezabel.com>
Orbitz:
> Do they appear in C++?
Yes.
> I would a dtor takes care of that for you when it comes to streams.
Only when the dtor is called. If a thread is aborted or exit or abort are
called then the dtor may not be called and your resource may leak.
> How does one safely write code in Ocaml that guarantees resources will be
freed?
You cannot so you make the best of a bad job and write code that catches
most errors in practice, like the code I gave. You might also add a
syntactic construct like F#'s "use" binding that makes this even simpler and
clearer but, ultimately, it is still not perfect.
Cheers,
Jon.
next prev parent reply other threads:[~2011-02-09 21:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 23:57 orbitz
2011-02-09 0:46 ` Guillaume Yziquel
2011-02-09 0:48 ` Jacques Garrigue
2011-02-09 6:25 ` dmitry grebeniuk
2011-02-09 12:01 ` rossberg
2011-02-09 15:15 ` orbitz
2011-02-09 16:14 ` Gerd Stolpmann
2011-02-09 16:52 ` David Rajchenbach-Teller
2011-02-09 17:54 ` orbitz
2011-02-09 21:50 ` Jon Harrop [this message]
2011-02-10 8:10 ` David Rajchenbach-Teller
2011-02-10 10:39 ` Guillaume Yziquel
2011-02-10 10:59 ` Guillaume Yziquel
2011-02-09 19:11 ` Florian Weimer
2011-02-09 20:10 ` Andreas Rossberg
2011-02-09 20:45 ` Florian Weimer
2011-02-09 21:12 ` Andreas Rossberg
2011-02-10 21:31 ` Florian Weimer
2011-02-09 18:03 ` Jon Harrop
2011-02-09 20:47 ` Norman Hardy
2011-02-09 21:00 ` Gabriel Scherer
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='047101cbc8a3$653f1ad0$2fbd5070$@com' \
--to=jonathandeanharrop@googlemail.com \
--cc=caml-list@inria.fr \
--cc=orbitz@ezabel.com \
/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