defmodule Trail.Store do
alias Trail.Store
alias Trail.Helpers
def append(key, value) do
Helpers.clock("Append", &Trail.Store.append_as_binary/2, [data_path(key), value])
{:ok}
end
defp append_as_binary(path, value) ..
And the Helper
defmodule Trail.Helpers do
alias Trail.Store
def clock(mark, fun, args) do
{time, result} = :timer.tc(fun, args)
IO.puts(mark <> ": #{Kernel.inspect(result)} Time: #{time} μs")
append_as_utf meta_path(mark), time
result
end
defp append_as_utf ...
defp meta_path ...
Where the append function is the entry point and the append_as_binary gives the module not available.
&M.f/a exposes the remote call to the receiving module, which then isn’t allowed to do that, you need to omit the module name and do Helpers.clock("Append", &append_as_binary/2, [data_path(key), value]) instead…