This is a nice example @Elrod. This is one of the situations where it’d be quite handy to be able to make Foo{T} <: T
. The other ones I’m aware of off the top of my head are
- Symbolic types: when making a symbolic programming system that models julia code, it’d be really nice if you could have say
Symbolic{Integer} <: Integer
andSymbolic{DenseArray} <: DenseArray
. - Autodiff: in automatic differentiation via operator overloading, you want a
Dual{T} <: T
so that you make sure you go down the right code-pathways for e.g.Real
versusComplex
primals.
A trait based approach would be quite nice for this.