I have a question about the convert method, Look at the example below, It 
tells me to define convert method here. 
Thanks

julia> type Foo{T}
       x::T
       end

julia> a = convert(Foo{Int64},12)
ERROR: MethodError: `convert` has no method matching 
convert(::Type{Foo{Int64}}, ::Int64)
This may have arisen from a call to the constructor Foo{Int64}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  Foo{T}(::Any)
  call{T}(::Type{T}, ::Any)
  convert{T}(::Type{T}, ::T)


But if I am to instantiate it normally a =Foo(12), it doesn't complete. And 
it calls some convert method which does the conversion right? How is this 
happening?

Thanks

Reply via email to