[erlang-questions] -spec for OTP
Tue Dec 6 12:28:38 CET 2011
On 12/06/2011 12:04 PM, Andrzej Sliwa wrote:
> do you know guys where I can find -specs for application and other OTP
> behaviors (I mean callbacks & api specifications)?
> this is weird that we see on many presentations about start using specs
> in modern erlang code, but there is no specs in OTP behaviors :D
Callback specs for OTP behaviours is a language addition that will
appear in the upcoming R15 release (scheduled for mid December).
There is a new attribute called -callback that specifies types that
behaviour callbacks are supposed to have. Given such information, one
does not need to specify a behaviour_info/1 function anymore (at least
as far as callbacks are concerned) since the compiler has been adapted
to automatically generate this function. In addition, the dialyzer tool
has been adapted to check behaviours.
As I wrote, this is coming in an OTP near you really soon now. In the
meantime, if you are interested in this you can get a copy of the
pre-release of R15 (from github) and see all behaviour modules
containing such callback attributes and/or read the following paper:
Typed callbacks for more robust behaviours
More information about the erlang-questions