https://github.com/juliadebug/cassetteoverlay.jl
An experimental simple method overlay mechanism for Julia
https://github.com/juliadebug/cassetteoverlay.jl
Last synced: 8 months ago
JSON representation
An experimental simple method overlay mechanism for Julia
- Host: GitHub
- URL: https://github.com/juliadebug/cassetteoverlay.jl
- Owner: JuliaDebug
- License: mit
- Created: 2022-11-28T05:35:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-10-01T09:10:59.000Z (9 months ago)
- Last Synced: 2025-10-14T11:52:25.278Z (9 months ago)
- Language: Julia
- Homepage:
- Size: 88.9 KB
- Stars: 32
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CassetteOverlay.jl
```julia
julia> using CassetteOverlay, Test
julia> @MethodTable sintable;
julia> @overlay sintable sin(x::Union{Float32,Float64}) = cos(x);
julia> pass = @overlaypass sintable;
# run with the overlayed method
julia> @test pass(42) do a
sin(a) * cos(a)
end == cos(42)^2
Test Passed
# invalidate the overlayed method and make it return `cos∘sin`
julia> @overlay sintable sin(x::Union{Float32,Float64}) = cos(x) * @nonoverlay sin(x);
julia> @test pass(42) do a
sin(a) * cos(a)
end == cos(42)^2 * sin(42)
Test Passed
```