This could be useful as a first look into a (sort ...
# compiler
y
This could be useful as a first look into a (sort of) basic compiler plugin. Currently the code is lacking in comments, but that's because I cobbled it together in like 7 hours lol, and so if you notice any improvements or any mishaps that I've made, I'd love to hear your feedback!
s
I imagine that sometimes you still want to pass null in place of default :) Instead of relying on nulls, it could be something like
fun <T> default(): T
which throws error, then you can substitute calls to that function similarly to what you already did :)
y
It's meant to be for Java callers, that's the thing, and so any clever trickery with substituting functions and whatnot is not gonna work. It was honestly just a hasty implementation for a specific use-case, but isn't that kinda the whole point of compiler plugins lol? Like yeah simply it's just some legacy code that this person still wanted to support, and the thing is on the Kotlin side such trickery isn't needed since you can just refer to parameters by their name, but on Java the convention of null meaning substitute a sane default for me here is common enough to warrant the existence of this.