>
> I am wondering if the best way to solve this problem would be to have a
> @before_compile callback that checks if you defined any of the callbacks
> with a different arity while, at the same time, did not define one with the
> proper arity.


This seems like a good compromise to me - it prevents common mistakes, but
doesn't require adding options to GenServer. In my opinion, imlementing the
:gen_server behaviour directly is how one rolls "strict" mode; adding
`strict: true` as an option (or even just adding options to `use GenServer`
to begin with) is too likely to cause confusion about what callbacks are
implemented by default, and how they behave.

Paul


On Fri, Sep 23, 2016 at 3:38 PM, José Valim <[email protected]
> wrote:

>   2. The default implementation of handle_info/1 will exit on any incoming
>> message, in the same way handle_cast/2 and handle_call/3 already do.
>>
>
> I believe this is not a good default because your processes may receive
> regular messages from other processes and you don't want to crash because
> of them. This is much more unlikely to happen with cast and call though, so
> we can afford to raise in cast and calls.
>
> I am wondering if the best way to solve this problem would be to have a
> @before_compile callback that checks if you defined any of the callbacks
> with a different arity while, at the same time, did not define one with the
> proper arity.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/CAGnRm4JqC6rzBUYJHd9ij%3DQRH9-
> mPNDG1qGk1hTMZ6r331iZKA%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JqC6rzBUYJHd9ij%3DQRH9-mPNDG1qGk1hTMZ6r331iZKA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAK%3D%2B-TuJubtpxxAOPP4iROHRBANdMo2kw%3D--Pajr0rymP2E8tQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to