The error actually makes sense:

- When you're asking for the transpose, it creates an empty b = Array(T1, 1, 
3)
- It then assigns a[1] to the first element of b[1]
- Assignment does this: b[1] = convert(T1, a[1]) because T1 is the eltype of b
- convert(T1, a[1]) is equivalent to T1(a[1])
- T1(x) is equivalent to T1(convert(Int, x)), because the first (only) field of 
T1 is Int. But you haven't defined a method for that, and that's what it tells 
you.

That said, I agree that in this case it's a bit confusing. If you have any 
good ideas for how to improve the error message without requiring mind-
reading, please do make suggestions.

--Tim

On Sunday, December 20, 2015 07:57:18 AM Lutfullah Tomak wrote:
> type T1
> x::Int #It can be any type
> end
> #x instead of x::Int (The type given in type definition)
> Base.convert(::Type{T1}, x)=T1(x)
> a = T1[1:3;]
> a' #--> gives error trying to convert T1 to Int.
> b = T1[1:3;]
> b[1] = a[1] #--> the same error
> b[1] = T1(1) #--> the same error

Reply via email to