Ahh, this is very helpful, thanks!!

Just another question, given that syntax (as a parametric type), how is one 
able to define a type like this:

type MyType
my_num::Real
end

... and then these work without issue:
x = MyType(3.4)
y = MyType(4)

I also ran into this issue when I defined a type where one of the params 
was defined to accept a Vector of any AbstractString, and then when I 
passed it a Vector of ASCIIStrings, it complained as in my initial message.

Thanks!

Chris

On Friday, October 2, 2015 at 9:12:35 PM UTC-4, Isaiah wrote:
>
> See 
> http://docs.julialang.org/en/release-0.3/manual/faq/#how-should-i-declare-abstract-container-type-fields
>
> On Fri, Oct 2, 2015 at 6:06 PM, Christopher Alexander <[email protected] 
> <javascript:>> wrote:
>
>> Hello all,
>>
>> I am trying to figure out what I'm doing wrong with the creation of a 
>> composite type, as below:
>>
>> abstract MyType
>>
>> type MySpecificType <: MyType
>>
>> type TestTypes
>>         type_test::MyType
>> end
>>
>> testing = MySpecificType
>>
>> x = TestTypes(testing)
>>
>>
>> After running the above, I get a MethodError: 
>>
>> ERROR: MethodError: `convert` has no method matching 
>> convert(::Type{MyType}, ::Type{MySpecificType})
>> This may have arisen from a call to the constructor MyType(...),
>> since type constructors fall back to convert methods.
>> Closest candidates are:
>>   call{T}(::Type{T}, ::Any)
>>   convert{T}(::Type{T}, ::T)
>>  in call at none:2
>>
>> Any ideas?
>>
>> Thanks!
>>
>> Chris
>>
>
>

Reply via email to