Le dimanche 20 décembre 2015 à 08:46 -0800, Lutfullah Tomak a écrit :
> I think I got what you mean after I tried but I'm still confused that
> why julia tries to do T1(a) instead of just
> copying T1 values to the indexed value of an array.
Well, I doesn't try to do T1(a) on its own. It tries to do
convert(T1, a), just like it would for a of any type to make it fit
into the array, but you told it that convert(T1, a) = T1(a).
Regards
> Best Regards,
>
> On Sunday, December 20, 2015 at 6:29:48 PM UTC+2, Milan Bouchet-Valat
> wrote:
> > Le dimanche 20 décembre 2015 à 08:11 -0800, Lutfullah Tomak a écrit
> > :
> > > In error, it tells that there is no
> > > convert(::Type{Int64}, ::T1)
> > > method. So, that's why I'm confused.
> > > I would expect instead that the error tells
> > > convert(::Type{Array{Int64,1}}, ::T1)
> > > has no method if it trys T1(a).
> > Why do you expect that when calling T1(a), you'd need to convert
> > from
> > T1 to an array? What happens is that Julia tries to fit the
> > existing T1
> > object into the x::Int field of the to-be-created T1 object, which
> > doesn't make sense.
> >
> >
> > Regards