# Compiler Plugins vs Macros

**URL:** <https://discuss.kotlinlang.org/t/compiler-plugins-vs-macros/12599>\
**Category:** Language Design\
**Created:** [May 5, 2019, 9:20am UTC](https://discuss.kotlinlang.org/t/compiler-plugins-vs-macros/12599 "2019-05-05T09:20:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![medium](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/medium/32/10404_2.png) [@medium](https://discuss.kotlinlang.org/u/medium)\
**Post date:** [May 5, 2019, 9:20am UTC](https://discuss.kotlinlang.org/t/compiler-plugins-vs-macros/12599/1 "2019-05-05T09:20:19Z")

</div>

I’m not an expert in compiler plugins or macro programming, but from a high-level perspective both looks similar. What are the differences? Why did Kotlin choose compiler plugins over macros? What is the impact on understandability and tool support?

---

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [May 5, 2019, 9:41am UTC](https://discuss.kotlinlang.org/t/compiler-plugins-vs-macros/12599/2 "2019-05-05T09:41:01Z")

</div>

The key difference is that macros works effectively rewrites the code before the code goes to compiler. Compiler plugin changes how existing code is processed by compiler. The compiler plugin is much more powerful, since it allows to add features not present in the language. Also there could be different level of compiler plugins. Some could affect only AST transformations and effectively work as a better controllable macros, some could affect compilation for specific platform.
