Skip to content

JuliaCompilerPlugins/ContextualDispatch.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ContextualDispatch.jl

A bare-bones implementation of contextual dispatch.

module Simple

using ContextualDispatch
import ContextualDispatch: Context, overdub

foo(x, y) = begin
    q = 10 + 15
    x + y + 10 + q
end

mutable struct SimpleCtx <: Context 
    call_num::Int
    SimpleCtx() = new(0)
end
function overdub(ctx::SimpleCtx, ::typeof(+), args...)
    ctx.call_num += 1
    ret = *(args...)
    ret
end

ContextualDispatch.@load_call()

r, c = call(SimpleCtx(), foo, 5, 10)
display((r, c))

end # module

About

A bare-bones implementation of contextual dispatch.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages