Any plans for something like Groovy-style AST transformations?


#1

I only had a quick look at Groovy's AST transformations and only have a superficial understanding of Groovy and its AST transformations. I have to admit to begin with that I know too little about it to tell whether this can be done in a statically typed language like Kotlin. But I saw that Groovy-style builders are already present in Kotlin to some extend. So maybe there is a way for AST transformations as well ... ;-).

The reason that I’m asking for this (I know sooner or later some geek would have done it) is that Groovy’s AST transformations have really impressed the … out of me. This is IMHO how to make a language scalable: rather than adding tons of features to a language (that only results in clutter if no one keeps an eye on keeping it coherent; let’s not mention any names of any specific programming languages here …) to achieve language scalability, these AST transformations manage to get exactly this done. I bet Java will never have this. And when I look at the JDK8 preview-release with which I can already now write code with closures and default methods (already now with IntelliJ’s EAP 12 release) I ask myself whether there has to be something in addition to keep the distance to Java.

Regards, Oliver


#2

Yes, we are planning to support AST transformaions, and make them a public API at some point.


#3

But some sort of support for the idea of AST transformations were on the schedule, no? See http://devnet.jetbrains.com/thread/439112


#4

Yes, something along these lines is planned


#5

Any changes on that? Are this plans revised?


#6

AST transformations are not on our medium-term roadmap at this time, but it’s possible that they will appear in a later version at some point.