Come to think of it, while the @forward macro is quite useful, it isn’t really a macro development tool nor a functional programming tool. So I’m not too surprised that it is treated like a second-class citizen in those packages.
Any thought about what kind of package would be a good fit for this?
It’s so trivial to implement, is there really a need for a package to do this? I have my own version of this, and I’m very happy using it. Perhaps we should take a lesson from the NPM leftpad fiasco and avoid distributing lots of trivial packages.
On the other hand, some kind of OoHelpers.jl might have a place that includes macros for method forwarding, implementing the “Holy trait” pattern and other OOP helpers–but not classical inheritance, for the love of God. A line must be drawn, here! This far and no further!
I might think about working on something like that, along with some documentation about Julia’s approach to OO.
I you are missing that, then a PR documenting it there would be the most straightforward solution.
Of course, but implementing it using MacroTools is rather easy, which is why I suspect it is in Lazy.jl, which already depends on MacroTools. Of course it is possible to do it from scratch, too.
One could make a mini-package that only has some version of @forward, and perhaps nothing else, or maybe a bit of related functionality. If there is a commitment to maintaining it, I would consider using @forward from there, but it would be great if it was a drop-in replacement for Lazy.@forward.
To my mind delegation is at the core of polymorphism via composition.
But it is surprisingly hard to generalize exactly what you want to do with it though.
Which is why you’ll see lots of code that is implementing it,
with some variations either with custom macros or loops over methods calling `@eval’
I believe that composition is used in many places in Julia but it may be that most people just write the delegation code manually. It would be nice to have a standard macro somewhere that is versatile enough to cover many use cases.