Will exporting a function name export all the different function versions in Julia?
Yes, you export the function name, and that function has two method in this case, and both of them will be available.
And to add, there is no way to export a subset of the methods.
That's right. Actually, there is no version of the export
statement that would allow you to pick which method to export. You export the function.
Here is some code which illustrates the behavior:
julia> module FooBar
export foo
foo(x::Int) = 2
foo(x::Char) = 'A'
end
Main.FooBar
julia> foo
ERROR: UndefVarError: foo not defined
julia> @which foo
ERROR: "foo" is not defined in module Main
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] which(::Module, ::Symbol) at .\reflection.jl:1160
[3] top-level scope at REPL[15]:1
julia> using .FooBar
julia> @which foo
Main.FooBar
julia> methods(foo)
# 2 methods for generic function "foo":
[1] foo(x::Char) in Main.FooBar at REPL[13]:4
[2] foo(x::Int64) in Main.FooBar at REPL[13]:3