because myconvert function needs some state info which is only generated
within another function , ex :

@special foo(x::A,y::A)
        (x+y) + (x+y)
end

@special generates state_info. So the definition down becomes implausible

+(x::C,y::C) = myconvert(A,x,state_info) + myconvert(A,y,state_info)

On Sat, Feb 27, 2016 at 11:43 PM, Toivo Henningsson <[email protected]>
wrote:

> Ok, I see the distinction as compared to regular type promotion.
> My point is that the Julia never does any implicit type conversion, if you
> want type conversion you have to invoke it yourself, such as by adding a
> method for +(::C, ::C) that does the conversion and adds the results.
>
> I think there's several reasons why Julia doesn't do implicit type
> conversion, including a) making it easier to understand what your code does
> and b) with multiple dispatch, it's not clear which method signature to
> convert the arguments to match.
>
> Why don't you want to provide a +(::C, ::C) method?

Reply via email to