Normally, the implementations are called through the dependency injection and they don’t need any use clause. Like this
defmodule TestBeh do
@callback ok :: :ok
@callback ko :: :ko
@optional_callbacks ko: 0
@default_impl Application.compile_env(:foo, :test_beh, TestImpl)
# default implementation
def ko, do: :ko
def ok(impl \\ @default_impl), do: impl.ok()
def ko(impl \\ @default_impl) do
impl = if function_exported(impl, :ko, 0), do: impl, else: __MODULE__
impl.ko()
end
end






















