Mantis - Bolt
Erweiterte Problemanzeige
49 general kleinerer Fehler immer 2009-12-17 13:11 2009-12-17 20:13
geschlossen 1.0-beta  
keine 1.0  
0000049: Bug or Feature in Bolt? Error if computed string in "LOG s LEVEL..."
Hello Xavier,

I want to use your bolt-library to have access to

In my code I use as an example this line:

 LOG (Printf.sprintf "walker: processing sdnumber: %s\n" s) LEVEL INFO;

But the compiler means that would be wrong:

 File "", line 37, characters 14-15:
 Parse error: [expr level ;] expected after "in" (in [expr])
 Preprocessor error

I compiled this with "ocamlopt.opt -pp "camlp4o $(BOLT) -level INFO"

If I replace the line with:

 LOG "walker" LEVEL INFO;

the compiler is happy and the binary will be created (and works as

If I am wrong, could you explain me this behaviour, please?

Thanks in advance,

Bye Andreas
2009-12-17 13:11 art1 Neues Problem
2009-12-17 20:13 xclerc Problemnotiz hinzugefügt: 0000198
2009-12-17 20:13 xclerc Status neu => geschlossen
2009-12-17 20:13 xclerc Lösung offen => erledigt
2009-12-17 20:13 xclerc Behoben in Version => 1.0

2009-12-17 20:13   
This is indeed how version 1.0-beta worked: the argument following the "LOG"
keyword had to be a string literal (and not any expression with type string).

However, I stumbled upon the very same problem you experienced.
As a consequence, the syntax has been extended to allow the following construct:
    LOG <format-string> <arguments> <attributes> LEVEL <lvl>

In your case, this means:
    LOG "walker: processing sdnumber: %s\n" s LEVEL INFO