There even are frameworks that make writing such plugins easier such as https://github.com/arrow-kt/arrow-meta (which enable to bring union type, higher kinded types, pattern matching, etc) Or https://github.com/google/ksp
There even are frameworks that make writing such plugins easier such as https://github.com/arrow-kt/arrow-meta (which enable to bring union type, higher kinded types, pattern matching, etc) Or https://github.com/google/ksp
Manifold[2] is basically a javac plugin if I'm not mistaken, and it shows just how powerful stuff can be accomplished with this approach (including e.g. auto-generation of Java types from common modelling languages like GraphQL, JSON, YAML etc. adds extension methods, unit expressions, ranges, C++-like preprocessors, structural subtyping, even crazy stuff like type-safe reflection - like Ceylon used to have!).
For Groovy, besides the built-in AST annotations like `@Immutable` and `@Canonical` (which turns a class into a data class, basically), you can achieve stuff like the Spock Testing Framework[3] which changes the Groovy syntax a little bit to make it really awesome for testing.
[0] https://www.baeldung.com/java-build-compiler-plugin
[1] https://groovy-lang.org/metaprogramming.html
[3] https://spockframework.org/spock/docs/1.0/spock_primer.html
It would be nice to have a list of such extensions of the language/bytecode
I regret so much losing Ceylon :(
Guessing this is a bit like Java's annotations. FWIW, I'm not a fan Java's annotation processing plugin stuff. It's fun for personal projects, cuz metaprogramming FTW. But debugging someone else's custom annotation stuff really sucks.