Skip to content

Instantly share code, notes, and snippets.

@tomasaschan
Last active August 29, 2015 14:04
Show Gist options
  • Save tomasaschan/ea7781b2eaedccfef12a to your computer and use it in GitHub Desktop.
Save tomasaschan/ea7781b2eaedccfef12a to your computer and use it in GitHub Desktop.
Importing and extending methods
module Baz
import Foo: bar
export Qux, bar
type Qux
x
end
bar(q::Qux) = bar(q.x)
end
include("Foo.jl")
include("Baz.jl")
using Foo
using Baz
println("After only one include:\n")
display(methods(bar))
println("\n\nIncluding Baz.jl again...")
include("Baz.jl")
println("\nNow, after two includes:\n")
display(methods(bar))
println()
module Foo
export bar
function bar(x)
println(x+1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment