OCaml Forge
SCM

Detail: [#871] pa_ocamlviz: doesn't properly rename parameters

Bugs: Browse | Download .csv | Monitor

[#871] pa_ocamlviz: doesn't properly rename parameters

Date:
2011-01-11 11:12
Priority:
3
State:
Open
Submitted by:
Török Edwin (edwin)
Assigned to:
Nobody (None)
Hardware:
PC
Resolution:
None
Severity:
normal
Version:
v1.0
Component:
None
Operating System:
Linux
Product:
None
 
URL:
Summary:
pa_ocamlviz: doesn't properly rename parameters

Detailed description
Testcase:
$ cat >x.ml <<EOF
let foo i = i*i;;
EOF
$ ocamlc -pp 'camlp4o str.cma ocamlviz/camlp4/pa_ocamlviz.cmo' -I +ocamlviz x.ml
File "x.ml", line 1, characters 12-13:
Error: Unbound value i

This is the code produced by pa_ocamlviz:
$ camlp4o str.cma ocamlviz/camlp4/pa_ocamlviz.cmo x.ml
let foo__pobs = Ocamlviz.Point.create "x_foo"

let foo__tobs = Ocamlviz.Time.create "x_foo"

let foo xxx0 =
(Ocamlviz.Time.start foo__tobs;
Ocamlviz.Point.observe foo__pobs;
let v = let bar x = x + i in bar (i * i)
in (Ocamlviz.Time.stop foo__tobs;

Notice that foo's parameter is renamed from 'i' to xxx0, BUT the uses of 'i' are not renamed to xxx0!


Versions:
Linux debian 2.6.36.2-phenom #4 SMP PREEMPT Sun Dec 19 21:43:06 EET 2010 x86_64 GNU/Linux

ocamlviz:
Installed: 1.01-2
ocaml:
Installed: 3.11.2-2

Followup

Message
Date: 2011-01-11 11:41
Sender: Török Edwin

Workaround: disable parameter renaming because it doesn't work:

--- camlp4/pa_ocamlviz.ml 2009-08-31 17:20:52.000000000 +0300
+++ /tmp/pa_ocamlviz.ml 2011-01-11 13:39:08.532428024 +0200
@@ -76,13 +76,13 @@
iter ee (x :: args)
| _ ->

- let rec repl_args args n =
+(* let rec repl_args args n =
match args with
[] -> []
| arg :: args ->
<:patt< $lid: Printf.sprintf "xxx%d" n$ >> :: repl_args args (n+1)
in
- let args = repl_args args 0 in
+ let args = repl_args args 0 in*)
let rec iterinv ee args =
match args with
[] -> ee

Attached Files:

Changes:

No Changes Have Been Made to This Item