^ What does adding that extra callback do? IIUC, it’s making three part of the contract of the behavior (so any code that relies on an X can expect a three even if the implementation doesn’t use X?
defmodule X do
@callback one(any) :: integer
@callback two(any) :: integer
@callback three(integer, integer) :: integer
defmacro __using__(_options) do
quote do
@behaviour X
defoverridable: three: 2
def three(o, t) do
one(o) + two(t)
end
end
end
end
Is that right?
And say I want X to use a behavior as well, like GenServer. So all implementers of X should transitively use GenServer. Does that go under __using__ or in the main module definition?
so is it
defmodule X
use GenServer
@callback ...
defmacro __using__ do
...
end
end
or
defmodule X
@callback ...
defmacro __using__ do quote do
use GenServer
end
end
end






















