>
> I find that it is rather rare to provide default callback implementations 
> for most behaviors
>

To be fair, I have been working on a project on and off for over a year, 
that contains two very large behaviours, where all callbacks are mandatory, 
but a majority of them can offer a default implementation derived from a 
few core ones—but should be overridable for performance optimizations. In 
short, the worst case scenario for the current common pattern; I'm sure 
this has exacerbated my frustration beyond normal levels.

You could also place default implementations in the behavior  module itself 
> and use defdelegate from the __using__ macro


This is the approach I was using for a while. The code in the gist I've 
linked to is essentially defining such a __using__ macro for you, for all 
of your callback functions, using a handrolled version of defdelgate that 
can also preserve documentation and optionally inline, instead of just 
delegating, the default implementations. Again, traits necessary to my 
usecase but ones that I think would nice to have in a boilerplate macro.

-- 
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/309216d9-81fb-4a83-9a8e-c7034d00d6ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to