Question

According to the erl_id_trans documentation:

Programmers are strongly advised not to engage in parse transformations and no support is offered for problems encountered.

Why are programmers strongly advised not to use parse_transform/2? Will this not be supported in the future? Other than parse_transform/2, is there a mechanism to inject code (runtime bytecode modification) or modify the source code before it gets compiled?

Was it helpful?

Solution

One reason I can imagine is that they don't want to fix the syntax tree format.

So if you use Parse teansforms and they break because of a new version of Erlang you can't complain.

Addendum: in the comments arose the question about other ways to manipulate Erlang source- or byte-code

  • For semiautomatic code refactoring there is Wrangler

  • You have acces to the Erlang preprocessor, tokenizer and parser, giving e.g syntax trees of your program

  • For easy and portable manipulation of abstract forms (what you get out of the parser or even beam-files) there are syntax_tools

  • For manipulating beam-files ther is beam_lib

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top