From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: [Caml-list] Destructive use of file descriptors
Date: Thu, 6 Aug 2015 11:40:31 +0200 [thread overview]
Message-ID: <20150806094030.GE16477@frosties> (raw)
Hi,
in Python one can write:
with open("foo") as fd:
fd.write(str)
This involves some language magic that will open the file for the
duration of the block and close it at the end. The file descriptor is
automatically closed at a know time and not leaked or left until the
GC gets around to cleaning it up.
Has anyone constructed something like that for ocaml? Maybe with a ppx
extension?
MfG
Goswin
next reply other threads:[~2015-08-06 9:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 9:40 Goswin von Brederlow [this message]
2015-08-06 9:48 ` Nicolas Ojeda Bar
2015-08-06 19:50 ` Malcolm Matalka
2015-08-11 9:36 ` Goswin von Brederlow
2015-08-11 11:14 ` Gabriel Scherer
2015-08-11 11:32 ` Ben Millwood
2015-08-06 9:48 ` Gabriel Scherer
2015-08-06 9:49 ` Pierrick Couderc
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=20150806094030.GE16477@frosties \
--to=goswin-v-b@web.de \
--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