From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 164F2BB83 for ; Thu, 11 May 2006 07:45:47 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4B5jjBe012846 for ; Thu, 11 May 2006 07:45:46 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA31714 for ; Thu, 11 May 2006 07:45:45 +0200 (MET DST) Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.195]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4B5ji1r012840 for ; Thu, 11 May 2006 07:45:44 +0200 Received: by wx-out-0102.google.com with SMTP id t12so86440wxc for ; Wed, 10 May 2006 22:45:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EokTwdl9AilbNxtntYF1G7bgyOXzjVTEA8eH//sWtOrXCmSPHS++nnDU0whsDawpFzYFRXvNYKvcG+UN7/fFZZKRXPmOZgS7+t4oJImLhY/zGXXZXziLgE1IOZeG4Dk0SC1doIAn//clm2O0f03wWSmrXUcfk1/wrhCVjq65NhU= Received: by 10.70.44.8 with SMTP id r8mr629072wxr; Wed, 10 May 2006 22:45:44 -0700 (PDT) Received: by 10.70.128.20 with HTTP; Wed, 10 May 2006 22:45:44 -0700 (PDT) Message-ID: <9d3ec8300605102245l6f975cd6ie45bb1741c443e47@mail.gmail.com> Date: Thu, 11 May 2006 07:45:44 +0200 From: "Till Varoquaux" To: "Geoffrey Alan Washburn" Subject: Re: [Caml-list] Re: OO design Cc: brogoff , caml-list@inria.fr In-Reply-To: <44628062.6010509@cis.upenn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <53c655920605050235k64e70333je8df813239ea3c53@mail.gmail.com> <20060508.121743.65190532.garrigue@math.nagoya-u.ac.jp> <200605082329.36911.David.Teller@ens-lyon.org> <445FB9C7.4040703@cs.washington.edu> <446152CB.5010605@cis.upenn.edu> <44621204.4020601@cs.washington.edu> <44628062.6010509@cis.upenn.edu> X-j-chkmail-Score: MSGID : 4462CF88.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 4462CF8A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4462CF88.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; unit-:01 cheers:01 caml-list:01 lisp:01 oops:01 boolean:02 data:02 string:02 string:02 seems:03 suggestion:03 guess:03 unit:03 unit:03 flush:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 > > Yoann Padioleau's suggestion to use the Lisp approach (with-open-file) > > looks like the best approach for ML to me. OOps, I just saw Yann's post.... guess I should have read this thread more carefuly before posting. > The only "solution" that I've seen that seems to actually solve t= he > "problem" is to write a small interpreted language for performing I/O, > but that is a bit heavy weight for general use. I might be stating the obvious but a solution that *should* work in most cases would be to use a event way of reading (think sax) where you would pass a "reading" function that would be called back one or more time with data from the file. If this "reading" function where to return false "read_from_file" would stop calling it back: read_from_file: (filename:String) (f:String->Boolean) : Unit The writing counterpart could be: flush_to_file:(filename:String) (f:Unit->String Option) : Unit where f would be called until it returned None. Note that this is a rather unflexible and inelegant solution. I don't recommand it. Cheers, Till