[erlang-questions] [Dialyser] Type parametrized behaviours

Francesco Mazzoli <>
Tue Apr 24 21:47:06 CEST 2012


On 24/04/12 20:36, Stavros Aronis wrote:
> In this case you can leave generic definitions in the -callback
> attributes and write the fully specified specs in the callback module:
>
> %% Behaviour module:
> ...
> -callback step(State :: term()) -> NewState :: term().
> ...
>
> %% Callback module:
> ...
> -type state() :: #state{}.
> ...
> -spec step(state()) -> state().
> ...

Yes, this works but is tedious and error prone, each time you change the 
behaviour you have to change each implementing module.

You end up manually doing something that a computer does much better 
(copy-pasting code).

Francesco.



More information about the erlang-questions mailing list