[erlang-questions] constructing function with merl
Karlo Kuna
kuna.prime@REDACTED
Tue Aug 28 22:34:18 CEST 2018
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@'{ _@REDACTED@ = 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'{ _@REDACTED = 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180828/6ba96a06/attachment.htm>
More information about the erlang-questions
mailing list