Using -spec for callbacks when defining behaviours

Mikael Karlsson <>
Wed Mar 17 12:01:56 CET 2010


Hi,

I understand that -spec (and -type)  constructs may be used in include
(.hrl) files and the module itself when specifying functions.

Has there been any discussion on beeing able to use them in behaviour
defining modules to specify the "callback" modules in more detail?

When defining a behaviour today you "just" specify the function names and
their arity with the behaviour_info/1 function.

I think it would be good to be able to also specify the types of the
arguments and their return type for the module implementing the behaviour.
This would make a behaviour defining module closer to a interface
specification and also decrease the depenencies of include files.

Mikael


More information about the erlang-questions mailing list