Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport ComposedFunction #720

Merged
merged 12 commits into from
Sep 25, 2020
Merged

Conversation

tkf
Copy link
Member

@tkf tkf commented Sep 10, 2020

I suggest adding Compat.ComposedFunction when/if JuliaLang/julia#37517 is merged. This way, individual packages like DataFrames.jl don't have to implement the same hack.

src/Compat.jl Outdated Show resolved Hide resolved
@martinholters
Copy link
Member

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)))

src/Compat.jl Outdated Show resolved Hide resolved
src/Compat.jl Outdated Show resolved Hide resolved
@tkf tkf marked this pull request as ready for review September 24, 2020 22:22
src/Compat.jl Outdated Show resolved Hide resolved
@@ -607,6 +607,37 @@ if VERSION < v"1.5.0-DEV.438" # 0a43c0f1d21ce9c647c49111d93927369cd20f85
Base.startswith(s) = Base.Fix2(startswith, s)
end

# https://github.com/JuliaLang/julia/pull/37517
if VERSION < v"1.6.0-DEV.1037"
export ComposedFunction
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added export since Base now exports ComposedFunction: JuliaLang/julia#37517 (comment)

test/runtests.jl Outdated Show resolved Hide resolved
Copy link

@jw3126 jw3126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@martinholters martinholters merged commit e3a642c into JuliaLang:master Sep 25, 2020
@tkf tkf deleted the composedfunction branch September 25, 2020 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants