Re:Erlang/OTP by Example
by _asummers on Monday October 22, 2018 @12:48AM
(#18272247)
Nah because as soon as you deviate from the GenServer behaviour you'll get errors from not matching the @callback. The trick there is to provide a narrower API that calls into the GenServer functions with the proper @spec and treat the handle_cast and friends as private functions that you don't call directly. So like a pop/0 might call cast(:pop) and you'd have the associated handle_cast for :pop.
[ Parent
| on HN ]
Yah, that's the error I ran into. Creating function wrappers to send messages works well for client api's. However, it doesn't help verify that you've implemented the `handle_cast` properly or dealing with messages from other places. Normally it's not to big of an issue.