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
An experimental simple method overlay mechanism for Julia
License
JuliaDebug/CassetteOverlay.jl
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
An experimental simple method overlay mechanism for Julia
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published