I know we aren’t supposed to use inheritance, and I’m all for not doing so, but in the simple case of a bunch of GenServer’s that all share exactly the same common handle_cast/3 of a particular message, I would like to put that handle_cast definition in a shared module where all the functions (API and callbacks) are as to avoid duplicating code in each individual GenServer module. Putting shared API fns works in this way because they are called client side, but how or can I put shared handle_xxx callbacks in a shared module this way as well?
I looked at behaviours, and that seems to be how general shared functions can be implemented, but GenServer callbacks seem special because they are ‘used’. Do I implement a new ‘dummy’ basemodule GenServer, and then have the other GenServers ‘use’ that basemodule Genserver?
Thanks.