For maximum simplicity, you could define a default outer constructor:
Minmax() = Minmax{Xy}(Xy(0,0),Xy(0,0))

And then your example works (without the type parameter). If you want to 
specify the type, then you need to slightly generalize this default 
constructor to something like:
Minmax{T}(::Type{T}) = Minmax{T}(T(0,0),T(0,0))

Is that roughly what you were trying to do?

Jason

On Monday, June 30, 2014 3:44:43 PM UTC-5, Kaj Wiik wrote:
>
>
> Let's assume that I have defined composite types
> type Xy
>     x
>     y
> end
>
> type Minmax{T}
>     min::T
>     max::T
> end
>
> To make code readable, I'd like to initialize nested composite type 
> variable like this:
> var=Minmax{Xy}()
> var.min.x = 0
> var.max.x = 1
> var.min.y = -10
> var.max.y = 0
>
> How to accomplish this? The problem is that 
> var=Minmax{Xy}()
> does not work.
>
> Any suggestions, other approaches?
>
> Cheers,
> Kaj
>
>
>
>

Reply via email to