From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1ALWLSa004119 for ; Thu, 10 Feb 2011 22:32:21 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUEAKHoU01XaqLJgWdsb2JhbAClahUBARYiJLpWhVwEjys X-IronPort-AV: E=Sophos;i="4.60,451,1291590000"; d="scan'208";a="91082848" Received: from ka.mail.enyo.de ([87.106.162.201]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 10 Feb 2011 22:31:56 +0100 Received: from [172.17.135.4] (helo=deneb.enyo.de) by ka.mail.enyo.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1Pne7H-0006nm-6S; Thu, 10 Feb 2011 22:31:55 +0100 Received: from fw by deneb.enyo.de with local (Exim 4.72) (envelope-from ) id 1Pne7G-00049h-VM; Thu, 10 Feb 2011 22:31:55 +0100 From: Florian Weimer To: Andreas Rossberg Cc: OCaml List References: <50AF76A1-30E0-4735-AFB2-88BB603899CE@ezabel.com> <77df810e993b3002f8b97622102da8dd.squirrel@mail.mpi-sws.org> <87hbcdvx99.fsf@mid.deneb.enyo.de> <72BF43D9-1BED-4327-955E-1A7460C18CDF@mpi-sws.org> <87sjvxszr1.fsf@mid.deneb.enyo.de> <8DECBDB1-84C6-4609-9C2A-8C9AEDE337A1@mpi-sws.org> Date: Thu, 10 Feb 2011 22:31:54 +0100 In-Reply-To: <8DECBDB1-84C6-4609-9C2A-8C9AEDE337A1@mpi-sws.org> (Andreas Rossberg's message of "Wed, 9 Feb 2011 22:12:49 +0100") Message-ID: <87pqqzmv91.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Caml-list] Scoped Bound Resource Management just for C++? * Andreas Rossberg: >> If you have coroutines or threads with communication among them, you >> can always turn type-enforced region-based handles into open handles >> with an explicit close operation. > > I still don't know what you are talking about. Why should a suitable > type system not be able to make such an operation ill-typed? It's a general problem. Once you've got message passing, you've got mutable state and the ability to escape regions. Basically, you do something like this: val resource = openResource params fun loop() (case receiveMailbox () of READ count => (read resource count; sendMailbox ACK; loop ()) WRITE buffer => (write resource buffer; sendMailbox ACK; loop ()) CLOSE => ()) end val _ = loop () val _ = close resource >> Like array bounds checking, integer division or other partial >> functions. 8-) > > Right. But these are examples of collateral damage of useful features, > while the one under discussion is just the damage, with no new > expressiveness to justify it. ;) It's not about expressiveness, it's about making writing correct (that is, resource-aware) code easier.