Hi,

I wrote a function to map contents of composite types to vectors and
dictionaries:

repack{S}(v::Vector, ::Type{S}) = S(v...)
repack{S}(d::Dict, ::Type{S}) = S([get(error,d,f) for f in fieldnames(S)]...)
repack{S,T}(x::S, ::Type{Vector{T}}) = T[getfield(x,f) for f in fieldnames(S)]
repack{S}(x::S, ::Type{Dict}) = [f => getfield(x,f) for f in fieldnames(S)]

A minor problem is that methods are ambigous (in practice, this does not
cause any errors though).

Is defining methods for each of the intersections the only way to
resolve this, or is there some alternative? If I could only dispatch on
a type being a composite type... Using v"0.4.0-dev+4616".

Best,

Tamas

Reply via email to