[julia-users] Check if type "contains" Any

2015-09-20 Thread Tommy Hofmann
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

Re: [julia-users] Check if type "contains" Any

2015-09-21 Thread Mauro
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/f