Hello,
I have a problem to which I have found a dirty solution and I am keen to 
know, if there is a principal one.

I have a composite type defined as

type Outer{T}
     A::T
     B::T
end

where A and and B are composite types

Then I want to create constructor
function Outer(k::Int)
  return(Outer(A{T}(k),B{T}(k))
end

But I have not find a way to put there the type information.
The only dirty hack I have come with to define the outer constructor as 

function Outer(k::Int;T::DataType=Float32)
  return(Outer(A{T}(k),B{T}(k))
end

But I do not like this solution too much. It is little awkward.

Thanks for suggesting a cleaner solution.

Best wishes,
Tomas

Reply via email to