That would work – then the type T is the second argument to the
TreeAnnotations constructor.

On Thu, Mar 5, 2015 at 4:49 PM, Ben Ward <axolotlfan9...@gmail.com> wrote:

> Oh yes! T needs to be in the tuple of function arguments. Phylogeny
> however does not have any parametric fields, so I'm unsure about using T
> with it. Would:
>
> function TreeAnnotations{T}(x::Phylogeny, ::Type{T})
>   return TreeAnnotations(x, NodeAnnotations{T}())
> end
>
> Be more acceptable and suitably Julian?
>
> Best,
> Ben.
>
> On Thursday, March 5, 2015 at 8:42:27 PM UTC, Tim Holy wrote:
>>
>> On Thursday, March 05, 2015 12:07:21 PM Ben Ward wrote:
>> > However Julia tells me about the TreeAnnotations{T}(x::Phylogeny)
>> function:
>> >
>> > Warning: static parameter T does not occur in signature for call at
>> none:9.
>> >
>> > The method will not be callable.
>>
>> Julia is warning you that you haven't actually used T: you've prepared
>> julia
>> for the fact that T will be a type parameter, but none of the arguments
>> are
>> parametric in T. Declare the function signature like this:
>>
>>     function TreeAnnotations{T}(x::Phylogeny{T})
>>       return TreeAnnotations(x, NodeAnnotations{T}())
>>     end
>>
>> Notice I added {T} to the end of Phylogeny.
>>
>> --Tim
>>
>>

Reply via email to