From: Joel Reymont <joelr1@gmail.com>
To: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
Cc: "OCaml List" <caml-list@inria.fr>
Subject: Re: GenerateFold
Date: Thu, 31 May 2007 23:34:57 +0100 [thread overview]
Message-ID: <534D9E1D-8F72-4972-8F53-DA64CA2DD20B@gmail.com> (raw)
In-Reply-To: <cd67f63a0705311505i40cc5983s6e55b1b03297e012@mail.gmail.com>
I thought I would try to reproduce the issue but I can't.
I get a different issue instead. It doesn't like the following line
| `FunArgDecl _ -> {< found = true >}
or `FunargDecl to be precise.
Also, what does {< found = true >} mean?
Thanks, Joel
---
ocamlbuild c.byte
+ /usr/local/bin/ocamlc.opt -c -I +camlp4 -pp 'camlp4of -I src -
filter map -filter fold -filter trash ' -o b.cmo b.ml
File "b.ml", line 11, characters 8-21:
This pattern matches values of type [> `FunArgDecl of 'a ]
but is here used to match values of type
< array : 'c. ('b -> 'c -> 'b) -> 'c array -> 'b; bool : bool -> 'b;
expr : A.expr -> 'b; float : float -> 'b; found : bool; id :
A.id -> 'b;
input_decl : A.input_decl -> 'b; int : int -> 'b;
list : 'd. ('b -> 'd -> 'b) -> 'd list -> 'b;
option : 'e. ('b -> 'e -> 'b) -> 'e option -> 'b;
program : A.program -> 'b; ref : 'f. ('b -> 'f -> 'b) -> 'f ref -
> 'b;
statement : A.statement -> 'b; string : A.id -> 'b;
subscript : A.subscript -> 'b; ty : A.ty -> 'b >
as 'b
cat _tags
"b.ml": use_camlp4, pp(camlp4of -I src -filter map -filter fold -
filter trash )
cat a.ml
type id = string
and program = statement list
and ty =
[
| `TyAny
]
and statement =
[
| `Skip
| `InputDecls of input_decl list
]
and subscript = expr list
and input_decl =
[
| `InputDecl of id * ty * expr
| `FunArgDecl of id * ty * subscript
]
and expr =
[
| `Int of int
| `Float of float
| `Str of string
]
cat b.ml
open A
class fold = Camlp4Filters.GenerateFold.generated;;
let is_fun_arg = object (self)
inherit fold as super
val found = false
method found = found
method input_decl x =
match super#input_decl x with
| `FunArgDecl _ -> {< found = true >}
| _ -> self
end
let is_fun x = (is_fun_arg#statement x)#found;;
module Camlp4Trash = struct
INCLUDE "a.ml";;
end;;
cat c.ml
open A
open B
--
http://topdog.cc - EasyLanguage to C# translator
http://wagerlabs.com - Blog
next prev parent reply other threads:[~2007-05-31 22:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-31 12:18 GenerateFold Joel Reymont
2007-05-31 15:29 ` GenerateFold Nicolas Pouillard
2007-05-31 17:41 ` GenerateFold Joel Reymont
2007-05-31 18:58 ` GenerateFold Joel Reymont
2007-05-31 22:05 ` GenerateFold Nicolas Pouillard
2007-05-31 22:16 ` GenerateFold Joel Reymont
2007-05-31 22:34 ` Joel Reymont [this message]
2007-06-01 6:08 ` [Caml-list] GenerateFold Edgar Friendly
2007-06-01 13:22 ` Joel Reymont
2007-06-01 13:30 ` Nicolas Pouillard
2007-06-01 13:44 ` Joel Reymont
2007-06-01 16:07 ` Nicolas Pouillard
2007-06-05 12:25 ` Nicolas Pouillard
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=534D9E1D-8F72-4972-8F53-DA64CA2DD20B@gmail.com \
--to=joelr1@gmail.com \
--cc=caml-list@inria.fr \
--cc=nicolas.pouillard@gmail.com \
/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