Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 pa_macro
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: camlp4 pa_macro
Is it possible to achieve with pa_macro something like this:

IFDEF NDEBUG THEN
DEFINE LOG(expr) = ()
ELSE
DEFINE LOG(expr) = Printf.printf expr
ENDIF
...
LOG("x=%d,y=%d" x y);

Unfortunately the code above does not work: debug version is OK, but then
NDEBUG is turned on I have

"This expression is not a function, it cannot be applied" on LOG()
expression.

If I use

LOG "x=%d,y=%d" x y;

then the release version surprisingly works, but the debug one gives

"Parse error: currified constructor"

How to overcome this? Another question: is there an up-to-date Camlp4
manual with all standard extensions (like pa_macro) properly documented?

- Dmitry Bely