Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are programmers "strongly advised not to engage in parse transformations"?

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?

like image 307
justin Avatar asked Oct 22 '11 12:10

justin


1 Answers

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

like image 64
Peer Stritzinger Avatar answered Oct 21 '22 12:10

Peer Stritzinger