English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-26 (14:24)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Re: Common IO structure
> > I see your point, tell me if I'm wrong :
> > You would like to add ExtLib IO's support to Camomile, without actually
> > need for the user to install ExtLib in order to compile your library.
> > true about that, and that's a good idea. I'll try to think about adding
> > OO wrappers on ExtLib IO, as well as conversion functions from/to ExtLib
> > input/outputs objects and records before next release.
> What I want is more than that.  I want that we agree some minimal set
> of methods for IO channles, and agree to accept such an IO channel as
> an argument for our library functions, or provide a converter to a
> native IO channel of the library.
> I'm interested in your opinion (and of all caml list participants).

Did you had a look at my OO wrappers proposal for IO module (posted on
ExtLib mailling list) ?

Some infos for people who doesn't know about ExtLib IO module :
ExtLib IO library is bi-polymorphic for performances reasons : it as two
polymorphic types parameters. A file input for example is a (char,string)
IO.input so there is two things we can write : chars and strings. Outputs
have a third parameter that is "what is returned by the close function" : a
file output is a (char,string,unit) IO.ouput , and a buffer output is a
(char,string,string) IO.output (the contents of the buffer is returned when
the ouput is closed).

here's how are created IOs :

val create_in :
  read:(unit -> 'a) ->
  nread:(int -> 'b) ->
  pos:(unit -> int) ->
  available:(unit -> int option) -> close:(unit -> unit) -> ('a, 'b) input

val create_out :
  write:('a -> unit) ->
  nwrite:('b -> unit) ->
  pos:(unit -> int) ->
  flush:(unit -> unit) -> close:(unit -> 'c) -> ('a, 'b, 'c) output

the "minimal set of methods" is 5 methods for both.
The OO wrappers I proposed are doing exactly what you want , they're
converting from and to IO input/outputs. Could you explain what part of the
problem they're not answering ?

Best Regards,
Nicolas Cannasse

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners