Browse thread
String representation of the expression: may camlp4 help?
- Dmitri Boulytchev
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dmitri Boulytchev <db@t...> |
| Subject: | String representation of the expression: may camlp4 help? |
Hello everybody,
I'm looking for the way to get string representation of the OCaml
expression
at compile-time to facilitate test writing. Consider an example:
let repr, value = WITH_REPR (1+2) in
Printf.printf "%s=%d" repr value
Here WITH_REPR is a meta-construction that returns ("1+2", 3) (generally
speaking WITH_REPR(c) whould return (string * type_of c)).
Is there some convinient way to do this? May camlp4 help?
Best regards,
Dmitri Boulytchev,
St.Petersburg State University