constructing function with merl

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

constructing function with merl

Karlo Kuna
i'm trying to construct simple function using merl, and documentation states taht any metavariable ending with @ character will be automatically represented as abstrast syntax but when i'm trying to do this: 

1> merl:show(merl:qquote("f(#'@R@'{ _@A@ = ok }) -> ok.", [{'R', rec}, {'A', field}])).                                         
function: f(#'@R@'{...}) -> ok.
  atom: f
  +
  clause: (#'@R@'{'@A@' = ok}) -> ok
    record_expr: #'@R@'{'@A@' = ok}
      atom: '@R@'
      +
      record_field: '@A@' = ok
        atom: '@A@'
        +
        atom: ok
    +
    atom: ok

this is not what i expect. I would expect this instead: 
function: f(#rec{...}) -> ok.
  atom: f
  +
  clause: (#rec{field = ok}) -> ok
    record_expr: #rec{field = ok}
      atom: rec
      +
      record_field: field = ok
        atom: field
        +
        atom: ok
    +
    atom: ok

which is what i get if i call: 
2>  merl:show(merl:qquote("f(#'@R'{ _@A = ok }) -> ok.", [{'R',      erl_syntax:abstract(rec)}, {'A', erl_syntax:abstract(field)}])).

what am i missing??
to clarify: i expect both calls to produce the same thing 

thank you

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions