Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Different types of streams
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Different types of streams
On Wed, Sep 05, 2001 at 08:56:41AM -0400, Dave Mason wrote:

> You omitted the part of my original email where I said that I honestly
> don't know how easy it is to use this through camlp4o.  If it's
> trivial (i.e. just add ``-pp camlp4o''), I don't understand why it
> won't be the default, and if it's not trivial, I (and several other
> people) will be unhappy.

Camlp4 allows to write pieces of programs in concrete syntax,
representing abstract syntax. I need that for the streams
implementation and optimization.

In my Camlp4 code, I manipulate things like this:
      <:expr< let x = y in z >>

To have the equivalent in OCaml, I should write:
     {pstr_desc =
         Pstr_eval
           {pexp_desc =
              Pexp_let
                (Nonrecursive,
                 [({ppat_desc = Ppat_var "x";
                    ppat_loc =
                      {loc_start = 4; loc_end = 5; log_ghost = false}},
                   {pexp_desc = Pexp_ident (Longident.Lident "y");
                    pexp_loc =
                      {loc_start = 8; loc_end = 9; log_ghost = false}})],
                {pexp_desc = Pexp_ident (Longident.Lident "z");
                 pexp_loc =
                   {loc_start = 13; loc_end = 14; log_ghost = false}});
            pexp_loc =
              {loc_start = 0; loc_end = 14; log_ghost = false}};
       pstr_loc = {loc_start = 0; loc_end = 14; log_ghost = false}}

I don't know for you, but I prefer program with the first form.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr