How about something like the following?
type CT{T}
ctsum::Complex{T}
ctsumsq::T
endx = 1 + 2im ctx = CT(x, convert(decomplexify(typeof(x)), x * conj(x)) You could also make a convenience function so you don't have to do the converts yourself for the second argument. Have you seen the standard docs on parametric types? http://docs.julialang.org/en/release-0.5/manual/types/#man-parametric-types
