How keyword arguments kwfuncs work

A collegue who was contributing to the internals of Zygote wanted to understand what was going on with


and

I gave a bit of an explination of f(x, kwargs...) lowering to f(::Core.kwfunc(typeof(f)), kwargs, x)
and the kwfunc function handling sorting the order of the keywords and filling in missing ones.
But I don’t fully understand it myself.
Where should someone go looking if they wanted to understand what is going on with these?

5 Likes

There is a short section about this in the devdocs:

1 Like