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

Get rid of MethodError: no method matching iterate(::Nothing) #632

Open
gdalle opened this issue Sep 29, 2023 · 1 comment
Open

Get rid of MethodError: no method matching iterate(::Nothing) #632

gdalle opened this issue Sep 29, 2023 · 1 comment
Labels
breaking a breaking change
Milestone

Comments

@gdalle
Copy link
Member

gdalle commented Sep 29, 2023

This frequent error happens because of the default dispatches

frule(ȧrgs, f, ::Vararg{Any}) = nothing
rrule(::Any, ::Vararg{Any}) = nothing

so when no rrule is defined, nothing is returned.
Unfortunately, it is hard to catch because the computations with nothing can go on for a while before erroring.

I wonder if removing these default dispatches would break something badly?

@gdalle gdalle added the breaking a breaking change label Sep 29, 2023
@gdalle gdalle added this to the v2 milestone Sep 29, 2023
@oxinabox
Copy link
Member

right now removing them would break Diffractor for sure, which actually uses the isnothing to decide if it is going to recurse.
And it would break Zygote that looks at the best matching method is that fallback.

I think a solid case can be made to remove them in 2.0 though.
I am sure we can work out a way to detect that case that is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking a breaking change
Projects
None yet
Development

No branches or pull requests

2 participants