Elixir: `@impl` documentation is not clear

Created on 11 Jul 2018  路  9Comments  路  Source: elixir-lang/elixir

reading the documentatation for @impl

  ### `@impl`

  To aid in the correct implementation of behaviours, you may optionally declare
  `@impl` for implemented callbacks of a behaviour. This makes callbacks
  explicit and can help you to catch errors in your code. The compiler will warn
  you if you mark a function as `@impl` when in fact it is not a callback, and
  vice-versa. It also helps with maintainability by making it clear to other
  developers that the function's purpose is to implement a callback.

What is the situation that it is exactly trying to describe by vice-versa?
does it mean that it will warn you when you don't add @impl to a call back? either case... it is not clear what vice-versa means and I suggest to explicitly mention it instead of using "vice-versa"

Sorry If it's just me, if not please somebody explain and I will submit a PR., thank you.

Elixir Documentation

Most helpful comment

What is the situation that it is exactly trying to describe by vice-versa?

It will warn if you mark a @impl when it is not a callback AND it will warn if it is a callback and you do not mark a @impl.

All 9 comments

does it mean that it will warn you when you don't add @impl to a call back?

I think it will warn you if other function was marked previously.

I agree that the docs can be improved. And maybe the docs should mention that it does not warn about missing @impl for overridable functions.

@fertapric master does warn about overridable functions, iirc.

What is the situation that it is exactly trying to describe by vice-versa?

It will warn if you mark a @impl when it is not a callback AND it will warn if it is a callback and you do not mark a @impl.

It will warn if you mark a @impl when it is not a callback AND it will warn if it is a callback and you do not mark a @impl.

But it will warn only if another callback was marked before

@fertapric master does warn about overridable functions, iirc.

Here is what the test suite says:

But, being honest, what I actually wanted to include in the documentation was this 馃槄:

@fertapric perfect. :) Basically @impl is per context.

@fertapric Would you like to take care of this issue?

I'm currently working on the warnings of聽#5800 馃檪

Feel free to pick it (I think you will do a much better job than me 馃槄).

I am tackling this.

Thank you @whatyouhide

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LucianaMarques picture LucianaMarques  路  3Comments

shadowfacts picture shadowfacts  路  3Comments

ericmj picture ericmj  路  3Comments

coryodaniel picture coryodaniel  路  3Comments

GianFF picture GianFF  路  3Comments