The TC plugin automatically finds the factory that...
# arrow-meta
r
The TC plugin automatically finds the factory that will be used as expression if found in the type class package, the data type package or in the local modules if flagged as
internal
h
Nice work! I also had a similar idea somewhat after reading about the extension bridge by Bartek Lipinski. Could be realized as an annotation processor as well, couldn't it? Scanning dependencies in the build for extension instances, write them to a generated source file, overload the extension bridge endcap, that could be sth like Compiler.resolve<X>()... Have you already investigated this?
r
Hi Hannes, thanks. I’m not sure this could be realised by just using annotations and codegen since the approach I’m following injects the resolved factories as expressions in default values of every call site replacing the default arguments for the found ones
it also rewrites function bodies in places where type classes are used to be nested in `with (tc) { ... }`so `tc`is part of the
this
scope in the function body and you don’t need to create scopes manually with `run`or
with
h
I think the first part could be done by generating endcap overloads, but of course, the second part not :) does your plugin already rewrite lambda scopes as well? Then the compound receiver stuff (limited to extensions) works, does it?
That replaces all functions with named args pointing to a `with`parameter and rewrites the body function by nesting it inside all the with scopes
h
Took a look at the branch, must say i am really impressed - how stable and complete is this whole thing?
r
getting there and pushing work weekly, this will be arrow meta which is the foundation for metaprogramming in which the type class system and arrow is built alongside DSL and APIs to easily build compiler plugins
users will have access to the low level phase functions which is what they do today but on a DSL without the visitor style the compiler follows and a high level DSL which is the quotes templates
s
That is rather amazing! I have tried to apply the DSL from meta github to my own pet project and, have to say, it's looking very promising would be happy to contribute if there's anything you need help with
❤️ 1
r
I'm finishing the base prototype support because it's still rather broken but I expect to bring into the arrow code base in 2 or 3 weeks
When I have something more solid
Then I'd love contribution
In the meantime if you want to play with it follows the latest commits and look at the list of ideas for plugins in the issues
We listed many arrow is gonna need and we need champions helping us elevate metaprograming in Kotlin
It's pioneering work since there does not seem to be bothering documented at the moment and we can't expect people to go off reading the compiler sources
You are welcome to add issues of everything you dislike and feel free to raise any concerns or bring ideas you think would be nice to have
👍 1