[erlang-questions] infinite loop in merl_tranform

Peti Gömöri <>
Sat Jul 9 17:57:50 CEST 2016


Hi Richard,

I tried to address the issue in this PR
https://github.com/erlang/otp/pull/1123

As a future improvement idea the parse transform could emit compilation
errors.
I'm not sure if it is easy to differentiate between cases which would fail
at runtime too and
cases which only fail during compilation (if there is any)

On Fri, Jul 8, 2016 at 10:48 AM, Richard Carlsson <
> wrote:

> Thanks for the report. Definitely sounds like a bug. I'm on vacation right
> now, but will look at it as soon as I can.
> Den 6 jul 2016 22:50 skrev "Peti Gömöri" <>:
>
> 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
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160709/773eef98/attachment.html>


More information about the erlang-questions mailing list