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

StackOverflow https://stackoverflow.com/questions/7859617

  •  11-02-2021
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top