Compiler warning for macros that do not return quoted expressions

28 views
Skip to first unread message

João Bernardo

unread,
Oct 22, 2016, 8:22:34 AM10/22/16
to elixir-lang-core
Hi !

I am quite new to elixir, and I am now learning macros. Today, when writing one of my first macros I was keeping getting an error, after 1h of debugging I realised that the only problem with my code was the lack of the `quote` block.

I was wondering if it is possible and if makes sense to add a compiler warning for macros that do not return quoted expressions ?

I am not sure if every macro should return a quoted expression or not, correct me If I am wrong.

Nonetheless, I believe this would useful thing for beginners and even for experienced developers, because forgetting a simple `quote` is really easy.

Louis Pop

unread,
Oct 22, 2016, 10:16:33 AM10/22/16
to elixir-l...@googlegroups.com
Hey João

It's perfectly valid to construct Elixir AST without using `quote`, so adding a warning here would result in the compiler warning when nothing is wrong.

Cheers,
Louis

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/251e7857-5791-4407-8ac8-c9d9a25477c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

João Bernardo

unread,
Oct 22, 2016, 10:48:29 AM10/22/16
to elixir-lang-core
By bad then x)

Thanks !

João Bernardo

unread,
Oct 22, 2016, 10:52:39 AM10/22/16
to elixir-lang-core
Btw Louis, can you show me an example where we can construct the AST without a `quote` block ? 


sábado, 22 de Outubro de 2016 às 15:16:33 UTC+1, Louis Pop escreveu:
Reply all
Reply to author
Forward
0 new messages