This works and makes perfect sense, thank you. May I bother you one more 
time? I want to generate these functions for a lot of operators, I create 
an Array containing them all and I loop over them to apply the macro:

macro operator_obs(name)
    dname = symbol(".$name")
    return quote
        function $(esc(name))(m1::M, m2::M)
            return M($(esc(dname))(m1.a, m2.a), $(esc(dname))(m1.b, m2.b))
        end
    end
end

ol = [+, -, *, /, ^]

for o in ol
    @operator_obs(o)
end

This won't work anymore because Julia complains that ERROR: LoadError: 
UndefVarError: .o not defined, which I understand. Is there any way to 
circumvent that?

Reply via email to