You can access the type parameters with T.parameters.  Have a look at
https://github.com/mbauman/Tuples.jl.  Also note possible complications
with vararg types.

However, doing this for non-tuple types this is probably a sign of bad
design as was recently discussed here:
https://groups.google.com/forum/#!searchin/julia-users/parameters/julia-users/d-HQdYEDjbc/VP8MydPBAgAJ

On Mon, 2015-09-21 at 05:10, Tommy Hofmann <[email protected]> wrote:
> I would like to write a function "contains_any(T)" which checks wether a 
> type T "contains" Any. For example
>
> contains_any(Integer) = false
> contains_any(Any) = true
> contains_any(Tuple{Integer, Any}) = true
> contains_any(Tuple{Tuple{Integer, Any}, Float64}) = true
>
> etc. How could one do this in julia?
>
> Thanks,
> Tommy

Reply via email to