Closed tkf closed 3 years ago
Would we want to add the constructors, too? It's a bit tricky, but something along these lines would work:
@eval ComposedFunction{F,G}(f,g) where {F,G} = $(Expr(:new, :(ComposedFunction{F,G}), :f, :g))
parentmodule(typeof(h)).eval(:($(nameof(typeof(h)))(f::F, g::G) where {F,G} = $(nameof(typeof(h))){F,G}(f,g)))
I suggest adding
Compat.ComposedFunction
when/if https://github.com/JuliaLang/julia/pull/37517 is merged. This way, individual packages like DataFrames.jl don't have to implement the same hack.