3 ms·
I'll take Elixir's macros and metaprogramming over Java's solution: annotations. With macros you can easily find and examine what it's doing. But annotations
by bcrosby95 6y ago
I'll take Elixir's macros and metaprogramming over Java's solution: annotations. With macros you can easily find and examine what it's doing.
But annotations are just tags that do nothing, and god knows where the code that actually does anything as a result of them resides.
- hosh 6y agoTo be fair, Elixir also allows developers to tag functions, which can then trigger macros. Some of them (like @doc) does not transform code, but others (like @impl, or Appsignal’s transaction decorators) will.
- nobleach 6y agoI'm not disagreeing with that sentiment, but I learned a considerable amount while implementing my own annotations. I do agree that they can be maddening... especially in the case of Spring Boot where you can forget to add a @Component annotation, and unit tests will pass... then you'll deploy your app and immediately see it blow up in prod.
- princevegeta89 6y agoYup the annotationPorn on Java is so unfortunate. I'll take any alternative to it any day.