@wrappertype WrapperT T field
macro that takes a type WrapperT with a field::T, and for each method defined for a type T (via methods_with) it defines a corresponding method acting on type WrapperT (unless method_exists says that the method already exists).
So, for example, you could define
type MyDict{K,V} :< Associative{K,V}
d::Dict{K,V}
end
@wrappertype MyDict Dict d
and it would create a drop-in replacement for Dict. This mechanism could even simulate some degree of multiple inheritance.
Just to make sure we talk about the same.
@wrappertype Dict MyDict d
Would expand to
keys(d::MyDict) = keys(d.d)
And so on...
Still, even if this occurs, the worst that is likely to happen is that an exception occurs, and you have to overload that method manually. The point of my suggested macro is that it would save a lot of manual labor, not necessarily all labor.
And once Julia gains the ability to overload the . operator, wrapper types can implement fall-through methods for field access too.