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

change ill-considered @invoke behavior #44902

Closed
StefanKarpinski opened this issue Apr 7, 2022 · 2 comments
Closed

change ill-considered @invoke behavior #44902

StefanKarpinski opened this issue Apr 7, 2022 · 2 comments

Comments

@StefanKarpinski
Copy link
Member

#38438 introduced this unfortunate behavior:

abstract type Foo end
struct Bar <: Foo end

f(x::Foo, y) = 1
f(x::Foo, ::Nothing) = 2
f(x::Bar, y) = 3
f(x::Bar, ::Nothing) = 4

x = Bar()
Base.@invoke f(x::Foo, nothing)  # should return 2, returns 1

Example due to @danielwe. I really think we should reconsider this. Yes, it's technically breaking. But man, this was really introduced and merged without enough discussion 😞. There were several objections to this behavior right after the PR was merged but then nothing was done about it.

@fredrikekre
Copy link
Member

fredrikekre commented Apr 7, 2022

@invoke is not exported and have no docs, so I think it is fair game to change (and perhaps export it in the process).

Edit: I guess I was grepping the wrong tree for docs, but it isn't exported at least.

@adkabo
Copy link
Contributor

adkabo commented Apr 9, 2022

@invoke is not exported and have no docs, so I think it is fair game to change (and perhaps export it in the process).

https://docs.julialang.org/en/v1/base/base/#Base.@invoke

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

No branches or pull requests

4 participants