-
-
Notifications
You must be signed in to change notification settings - Fork 16
Fix recursion performance #61
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
Conversation
22d0ecc
to
75d0300
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there packages outside Flux using the walk-based API? Better to make a breaking change soon before more people adopt the new (bad) API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a couple of formatting nits from me.
Co-authored-by: Brian Chen <ToucheSir@users.noreply.github.com>
I don't believe this has got a release? |
I don't remember why. Might've held off because of the recent TagBot issues that prevented tags and release notes from being published. See JuliaRegistries/General#77862 |
This PR simplifies the recursive structure of walking a functor. It uses a trick from JuliaLang/julia#47760 to resolve #59.
The functionality of
fmap
after this PR is identical to its previous one. Thus, this PR lays bare the fact that the argumentf
is ultimately useless for the version offmap
that takes a user-specified walk. Note that this was public API, however, so I kept it in the signature and added an explanatory note.Obviously the
fmap
API is highly imperfect, but I think this PR is a strict improvement, that simply lays bare some of the issues. (Ultimately, I think that the use offmap
with a user-specified arbitrary walk should probably be deprecated: walks are just way too flexible to allow arbitrary walks to be paired withfmap
. The semantics offmap
seem to match best with the specific use case ofExcludeWalk
:ExcludeWalk
is what actually usesf
, after all. The general function allowing for arbitrary walks should probably be calledrecursivewalk
or something. But that would be very breaking.)