[erlang-questions] Recommendations on optional callbacks
Federico Carrone
federico.carrone@REDACTED
Tue Jul 22 17:16:11 CEST 2014
I do not know if this information might help you, but it might be useful
for somebody else:
I am using mixer (https://github.com/opscode/mixer) from the Chef guys for
solving this issue when coding cowboy handlers. I have a default cowboy
rest handler that implements all the default implementation. All the
handlers use the default cowboy rest handler implementation if I they do
not implement functions like is_authorized or forbidden.
Regards,
Federico.
On Mon, Jul 21, 2014 at 6:07 PM, Jay Nelson <jay@REDACTED> wrote:
> We have created a behaviour with -callbacks, but would like to simplify
> the implementation by providing default implementations of some of the
> callbacks. Using erlang:function_exported/3 to test for a user-supplied
> callback and instead calling a default implementation may work, but the
> compiler will complain for the user-defined module if no callback is
> supplied. What is the recommended best practice for this situation?
> The best I can come up with is to document the default implementation
> and leave it up to the user-defined module to call that function or
> provide its own so that the callback is always present.
>
> jay
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
http://federicocarrone.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140722/8d9a4950/attachment.htm>
More information about the erlang-questions
mailing list