[erlang-questions] Any Erlang Devs Contemplating Elixir?

Garrett Smith <>
Sun Mar 6 17:32:02 CET 2016


On Sat, Mar 5, 2016 at 10:04 PM Robert Virding <> wrote:

> One definite benefit in having to explicitly write every callback even if
> it is doing "default" stuff is that everything *IS* then explicit and you
> can directly SEE what happens. And come on, writing a 2 line default case
> for a few callbacks is really not that much to extra code.
>
> A major problem with having implicit "default" cases is that what people
> consider to be a reasonable default handling varies depending on what just
> that server is doing. There is no default that suits every server so I will
> probably have to write it out and anyway.
>
> Hiding callbacks behind defaults also means that you don't SEE everything
> that is there. This can be a major problem for newcomers.
>

A counter point to this is that by deferring increasingly complex cases by
providing sensible defaults, a user can more quickly and correctly
understand an API. A useful abstraction has a story line - and I think the
simpler the better. Requiring the user to accommodate increasingly edge
cases undermines the main story line.

E.g. I like the pattern in Erlang functions that follows the getopt Tao of
required params + options. Let me get to the gist of an operation with the
fewest possible inputs and I can incrementally grow into the more complex
cases.

I think this is less about typing and more about clarity of intent.

The challenge to getting this right is drawing that line between the
essential interface and the incremental enhancements. Libraries fail when
they outright hide important details and leave the user mystified with
seemingly magical behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160306/e6a82cd0/attachment.html>


More information about the erlang-questions mailing list