I have a bit of contrived example of where I have parametric type on parametric type. I have the following types expressing unbound and bound distributions:

```
abstract Distribution{T}
abstract UnboundDistribution{T} <: Distribution{T}
abstract BoundDistribution{T} <: Distribution{T}
```

Type parameter `T`

is mainly to distinguish two main uses: some computation is performed numerically but some can be performed symbolically via `SymPy`

. So, sometimes `T`

is `SymPy.Sym`

, and sometimes `T <: Real`

.

Things get complicated when I consider truncated distribution: previously unbound (e.g. log-normal) distribution that was bound “artificially” by transforming the variable. For this I have the type:

```
type TruncatedDistribution{U,T <: UnboundDistribution{U}} <: AbstractTruncatedDistribution{U}
d :: T{U}
xmax :: U
end
```

What I want to express here is that the resulting type is going to be bound and parameterized by a type `U`

(`SymPy.Sym`

or `<: Real`

depending on use), internally it contains an unbound distribution, parameterized by the same type `U`

and maximum value of the variable of the same type `U`

.

Julia (0.5) does not allow me to do this. There are two problems here:

- I cannot refer to
`U`

when I specify`T`

, i.e. this:`T <: UnboundDistribution{U}`

is not allowed, and - I cannot say
`T{U}`

when defining`d`

If 1 were allowed, I wouldn’t need 2.

Is there a way to express all the constraints I want?