I have a couple of types defined like this:
struct Foo
foo
end
struct Bar
foo::Foo
bar
baz
end
Then I have a bunch of functions defined for Foo
, with additional methods for Bar
that just pass through the foo
field:
func1(f::Foo, x) = x + f.foo
func1(b::Bar, x) = func1(b.foo, x)
func2(f::Foo, x, y) = x*y - f.foo
func2(b::Bar, x, y) = func2(b.foo, x, y)
Is there some way to generate the Bar
methods automatically, using a macro or something?