[erlang-questions] infinite loop in merl_tranform

Peti Gömöri <>
Wed Jul 6 22:50:34 CEST 2016


Hello,

While being knee deep in metaprogramming with merl (OTP 18.3) I made a
small typo which led the compilation of my module into an infinite loop.

I managed to shrink it down to a module like this

    -module(infinity).
    -export([f/1]).
    -include_lib("syntax_tools/include/merl.hrl").
    f(V) -> merl:qquote("@var", [{var, V}]).

( or this oneliner call
    Form = merl:quote("f(V) -> merl:qquote(\"@var\", [{var, V}])."),
merl_transform:parse_transform([Form], []).
)

Seems to me that the optimisation to create templates at compile time in
merl_transform:expand_qquote is tricked.

Can this be considered a bug? I would expect either a compilation error or
just silently creating a module which will throw at runtime.


thanks
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160706/a7193343/attachment.html>


More information about the erlang-questions mailing list