From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 27E0F7EEBF for ; Thu, 6 Aug 2015 11:40:33 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.17.12 as permitted sender) identity=mailfrom; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.17.12; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BLAQAFK8NVnAwR49RbyzdMAQEBAQEBEgEBAQEBBg0JCSEuhGR7NAUoiEwBGaZjoAkfhiaQdoMBgRQFlQGMVYhSDJETgXyCKYM5AQEB X-IPAS-Result: A0BLAQAFK8NVnAwR49RbyzdMAQEBAQEBEgEBAQEBBg0JCSEuhGR7NAUoiEwBGaZjoAkfhiaQdoMBgRQFlQGMVYhSDJETgXyCKYM5AQEB X-IronPort-AV: E=Sophos;i="5.15,622,1432591200"; d="scan'208";a="142166222" Received: from mout.web.de ([212.227.17.12]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Aug 2015 11:40:32 +0200 Received: from frosties.localnet ([95.208.221.151]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MLPaA-1ZMjQj31jm-000aXY for ; Thu, 06 Aug 2015 11:40:31 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.84) (envelope-from ) id 1ZNHf5-0004aF-57 for caml-list@inria.fr; Thu, 06 Aug 2015 11:40:31 +0200 Date: Thu, 6 Aug 2015 11:40:31 +0200 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20150806094030.GE16477@frosties> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:rX5SdpN7H/LVe0TQC6AuFtxNblP7+IOPt3ZNDsRwYV2Rl3zkL8I bj6gN/UqnstwGsYgbUr6Mgm1jGnQVcQXjMDNvV2DnxixvSl/YbkvAzqpZB8rVtUIJYdPZBi whDxihqE0NfmQusuFrUTbXuX9u6zg2ZNeKq1rs5Ss6IdkAcRj9rwdqTzzwLBDMjl4kvigD0 S7GotCyzoY8K47eSSTo8w== X-UI-Out-Filterresults: notjunk:1;V01:K0:X9Bo3U+mH+4=:KeJVQ7dC+mIVAksr/EcWNp 0oOzLY5ctCohaL3FhtbP8DJDHX7cQ9DWEhOz3BzAEPZB9ncoLphMWBpJApmozGbs48P+OgyEy NshDeOlkoMa9T4sWxh0fOyxnZ8s59fwcBDCbYe6I9WQ8xgKMIOc5Dohr5qJ39fkFkpRc+AsBg t+PjbWHCl9NV2mqoP4gwJR4MEFvKamvBjqgw1jI3FFlcOz7q0k9iGcQGSug85tAiER9LTzSqv GXHpTxrJyXTWsJOYZnGstTTVup0O3O/cMtClFmwMP2xSHmstHllFGiINhjTWcDk82LjXvbDG7 fxlTOobcw7RnorLdRJorMMzJHu7onbVWiRka7y4uYcJ6yVXlVzbemv923mFy4k4m8XsQ5bi4O jkphWa5cYGEnzRS9nibFX2m0Y73z1j7PjDaNW3wu/XEu5KlRb3Hdp+HulpjOqMQeckGAuhq0E pxoGPDerGD4pTaDrf7r7D40ZBjCwcc83XpCU+Y6KhSaBrXiXehfjWloLTTLS0kDEsflEhEvNj DEiOpx5VuMQu+QsoFuRxMU4BaSxle2vmN+z/B6Vzq2xHa1LgRW2Wi5izs+WyKAuYmx8fvfgAx 2OaqPNkVcYuMF+QOBoIWtGBO3kHJIBpIXF9VAMs5hkSyO80oVkpohNo3JFUXjz0ymL9sGdz8c d5PIU2fInIHvhl2J8L6jiZMGCVy11IfjsZAtzOhiePYxmeQ== Subject: [Caml-list] Destructive use of file descriptors 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