Hi everybody, 
I'm looking for a  metaprogramming trick to solve the following problem 
(I'm confident it can be done efficiently with julia) . Let's say I have 
defined a type in a module along with some methods:
module ModA
export A,f1,f2,f3

type A
...
end

f1(a::A, x::Int) = ...
f2(x, a::A, y) = ...
f3(a1::A,a2::A) = ...

end #module
Now I have a second type that encapsulate the first 

using ModA

type B
a::A
...
end

and I would like to define a macro that automatically defines all the 
exported function in ModA for the type B in the trivial way, that is

f1(b::B, x::Int) = f1(b.a, x)
f2(x, b::B, y) = f1(x, b.a, y)
f3(b1::B, b2::B) = f1(b1.a, b2.a)

A starting point could be methodswith(A, ModA), but I don't know how to 
procede further. Suggestions?

Bye,
Carlo

Reply via email to