Why throw macros as much as possible?

What transaction is not executed with macros? or what is the deal with trying to avoid macros?

I saw posts that recently talked about slowing down the use of macros: DSL! = Macros, rewriting code with functions instead of macros, starting research to switch from macros to functions ...

but what is this deal? do you think macros will rule the world and you donโ€™t want to?

What is wrong with macros? why reduce their use? Shouldn't they be a method of expanding the language?

+4
source share
3 answers

The main argument that I see for preference for function macros is that they are not available as first-class functions at runtime, which limits your flexibility when using various powerful functional programming methods.

Personally, I believe that macros are still an extremely useful software tool that allows you to use them appropriately, that is, you can perform complex code transformations at compile time, which would otherwise be costly or require a lot of unnecessary template.

+12
source

Christophe Grand's presentation in clojure -conj covered this well: http://vrac.cgrand.net/DSL.pdf

We hope that the videos will be soon.

+4
source

Drop macros as much as possible:

  • without resorting to code duplication ,
  • pattern repeat
  • writing fuzzy code,
  • or as mikera points out, making significant calculations at runtime that could be done at compile time.
0
source

All Articles