methods(TT) call(::Type{TT}, x::Float64, y::Float64) at In[22]:2 call(::Type{TT}, x, y) at In[22]:2 call{T}(::Type{T}, arg) at essentials.jl:56 call{T}(::Type{T}, args...) at essentials.jl:57
So I guess the rule is applied in call(::Type{TT}, x, y) What does it do? Does it try to convert(Float64, x) & convert(Float64, y)? I.e does it always try to convert each argument to the type of the field defined in the type? On 5 April 2016 at 15:11, Yichao Yu <yyc1...@gmail.com> wrote: > On Tue, Apr 5, 2016 at 10:09 AM, FANG Colin <colinf...@gmail.com> wrote: > > Sorry if this has been discussed somewhere as I am unable to find the > > relative post. > > > > immutable TT > > x::Float64 > > y::Float64 > > end > > > > function tt(x::Float64, y::Float64) > > x + y > > > > end > > tt(1,2) # doesn't work > > TT(1,2) # works > > There are automatic constructors defined with conversion not promotion. > See `methods(TT)` > > > > > What rule applies here for TT(1,2)? >