Evan Fields wrote:

> How about something like the following?
> 
> type CT{T}
>     ctsum::Complex{T}
>     ctsumsq::T
> end
> 

I'm aware that it's easier to make the type parameter the scalar type, 
allowing writing as you show, but as a learning exercise I'd like to know 
how Julia would go the other way.

In c++ this would be done with template metaprogramming, but as Julia claims 
to have types as 1st class objects, I thought there should be some elegant 
way to do this.

That is, given T is Complex{U}, I need the type U so I can write
ctsumsq::U

Reply via email to