@behaviour, @callback and @spec

GenServer is not good example here is it’s most probably intended to not add @doc and @spec to those functions. Anyway I can see what you are talking about. For sure adding @doc false when you really expect documentation is really bad, but @doc delegate_to is still ok here

More … for this use case when most of projects don’t even document those functions it could be nice to properly link them to GenServer documentation page. I believe that core team does not wanted to add extra documentation for every module which uses GenServer as reading documentation could be a bit harder due to more documentation.

I have similar feeling to HTTPoison. Omitting that you are linking to deprecated function we can still use @doc delegate_to in such case without any problem.

ok, so for me it’s even not an option to consider :smile:

Personally I don’t like be forced to something. I’m like Erlang/Elixir - I can fail as much as I need. No matter how much times - sooner or later I would be better. If I would be limited in order to protect myself then I’m not going to make fails and learn on them. Look that Elixir is written to be as much extensible as possible.

The goal here is to introduce well known standards (just like adding optional @spec support), but not force them. Imagine what would happen if suddenly all hex libraries would fail, because @spec would be required for all functions. Look that @spec everywhere would be like a dream for readers, but also huge pain for maintainers.

Sooner or later you would get an edge-case. There is no rule in world to cover all cases, so forcing anything is never a good idea. It’s why phoenix is not called a framework, but library.

You have lots of cases when you need to take a look at other modules to understand code properly especially in cases like GenServer. You just need to remind from time to time handle_call, handle_cast and handle_info.

Personally I think that delegating documentation is much better, because same documentation and spec does not need to be written multiple times. Of course we do not see it in such simple examples.

Simply compare:

@doc delegate_to: {MyBehaviour, :foo, 0}

which is never going to change with copy-paste long specifications especially with map (optional and required keys).

There is no even need to imagine long map specification. Just look at really simple init/1 specification:
https://github.com/elixir-lang/elixir/blob/0a81b278619324e088641abe9d486dca8a6510b5/lib/elixir/lib/gen_server.ex#L447
You would have few extra lines for each implementation’s function just to not make one click on HTML page and it’s not even middle size of typical real world specification..