Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Till Varoquaux" <till.varoquaux@gmail.com>
To: "Geoffrey Alan Washburn" <geoffw@cis.upenn.edu>
Cc: brogoff <brogoff@speakeasy.net>, caml-list@inria.fr
Subject: Re: [Caml-list] Re: OO design
Date: Thu, 11 May 2006 07:45:44 +0200	[thread overview]
Message-ID: <9d3ec8300605102245l6f975cd6ie45bb1741c443e47@mail.gmail.com> (raw)
In-Reply-To: <44628062.6010509@cis.upenn.edu>

> > 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 the
> "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


  reply	other threads:[~2006-05-11  5:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-05  9:35 David Baelde
2006-05-05 10:47 ` [Caml-list] " Gerd Stolpmann
2006-05-05 13:00 ` Remi Vanicat
2006-05-05 19:32   ` Andrej Bauer
2006-05-08  3:17 ` Jacques Garrigue
2006-05-08 21:29   ` David Teller
2006-05-08 21:36     ` Dan Grossman
2006-05-10  2:41       ` Geoffrey Alan Washburn
2006-05-10 16:17         ` [Caml-list] " Dan Grossman
2006-05-10 18:15           ` Geoffrey Alan Washburn
2006-05-10 18:44             ` [Caml-list] " Dan Grossman
2006-05-10 18:35           ` Shawn
2006-05-10 18:47             ` Till Varoquaux
2006-05-10 19:01               ` Shawn
2006-05-10 18:43           ` brogoff
2006-05-11  0:08             ` Geoffrey Alan Washburn
2006-05-11  5:45               ` Till Varoquaux [this message]
2006-05-11  6:21               ` [Caml-list] " Jacques Garrigue
2006-05-11 15:48                 ` Geoffrey Alan Washburn

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=9d3ec8300605102245l6f975cd6ie45bb1741c443e47@mail.gmail.com \
    --to=till.varoquaux@gmail.com \
    --cc=brogoff@speakeasy.net \
    --cc=caml-list@inria.fr \
    --cc=geoffw@cis.upenn.edu \
    /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