As a library writer my objectives are:
- Be useful (ok, obvious) and reliable
- Have good documentation
- Deliver responsive support
- Support multiple Elixir releases in a single library release
- And to do so without emitting compiler warnings since as a consumer, compiler warnings in a lib don’t inspire confidence.
Sometimes callbacks change between Elixir releases (and I’m a contributor to that). And I can’t find a way to conditionally compile @callback
and @impl
to achieve (4) and (5) above. Which means depending on which Elixir release I get:
warning: got "@impl true" for function inspect_time/5 but no behaviour specifies such callback.....
I’ve tried wrapping @imp true
in a conditional like
if Version.compare(System.version(), "1.10.0-dev") in [:eq, :gt] do
@impl true
end
Unfortunately the @impl
true is inserted into the code anyway. Any ideas on how to conditionally compile @callback
and @impl
would be appreciated.
I know I could just remove all the @impl true
directives but that seems a last resort.