Skip to content

Instantly share code, notes, and snippets.

@jpfairbanks
Created October 23, 2015 18:02
Show Gist options
  • Save jpfairbanks/1cb88f37eb70e5b89e72 to your computer and use it in GitHub Desktop.
Save jpfairbanks/1cb88f37eb70e5b89e72 to your computer and use it in GitHub Desktop.
Metaprogramming julia
import Base.Test
type T
a::Int
end
type S
t::T
b::Int
end
function f(t::T)
return t.a
end
function f(s::S)
return f(s.t)
end
t = T(1)
s=S(t,2)
S(T(1),2)
@test f(s) == f(s.t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment