I saw this here: allow `@overlay` for methods with return type declaration by aviatesk · Pull Request #51054 · JuliaLang/julia · GitHub
But I could not find any documentation about it. Does someone know?
I saw this here: allow `@overlay` for methods with return type declaration by aviatesk · Pull Request #51054 · JuliaLang/julia · GitHub
But I could not find any documentation about it. Does someone know?
From the source code docs:
This can be used to implement a method override mechanism. Regular compilation will not
consider these methods, and you should customize the compilation flow to look in these
method tables.
Also - it makes a reference to OverlayMethodTable.
But what would it be good for? Any example?
Or is it just for internal use?
I do not suggest I studied it or that I have a deep understanding - but from what I’ve searched so far, this seems a good place where you can find some use cases: https://github.com/JuliaLang/julia/blob/master/test/compiler/AbstractInterpreter.jl
Also - keep in mind that the PR referenced by you only extends the macro to work with methods with return types. @overaly
has been part of the experimental
for a pretty long time.
It’s generally used for low level replacements of specific functions in the GPU ecosystem, with versions that e.g. don’t throw errors or have some other special GPU implementation.
From userland, you can use the functionality via GitHub - JuliaDebug/CassetteOverlay.jl: An experimental simple method overlay mechanism for Julia.