[erlang-questions] Erlang/OTP R15B has been released
Thu Dec 15 10:52:15 CET 2011
W dniu 15.12.2011 10:21, Lukas Larsson pisze:
> OTP-9621 is the ticket number relating to this change.
> OTP-9621 Add '-callback' attributes in stdlib's behaviours
> Replace the behaviour_info(callbacks) export in stdlib's
> behaviours with -callback' attributes for all the callbacks.
> Update the documentation with information on the callback
> attribute Automatically generate 'behaviour_info' function
> from '-callback' attributes
> 'behaviour_info(callbacks)' is a special function that is
> defined in a module which describes a behaviour and returns a
> list of its callbacks.
> This function is now automatically generated using the
> '-callback' specs. An error is returned by lint if user
> defines both '-callback' attributes and the behaviour_info/1
> function. If no type info is needed for a callback use a
> generic spec for it. Add '-callback' attribute to language
> Behaviours may define specs for their callbacks using the
> familiar spec syntax, replacing the '-spec' keyword with
> '-callback'. Simple lint checks are performed to ensure that
> no callbacks are defined twice and all types referred are
> These attributes can be then used by tools to provide
> documentation to the behaviour or find discrepancies in the
> callback definitions in the callback module.
> Add callback specs into 'application' module in kernel Add
> callback specs to tftp module following internet
> documentation Add callback specs to inets_service module
> following possibly deprecated comments
> On Thu, Dec 15, 2011 at 8:00 AM, Jack Moffitt <jack@REDACTED> wrote:
>>> PS. It's of course not a big deal, but it's a bit of a pity that behaviour
>>> callbacks was not listed in the R15B release highlights... It's a language
>>> addition after all, which had to wait for quite a long time in order to be
>>> included in a major instead of some minor release.
>> I can't seem to find any mention of it in the README either. Would you
>> mind pointing us to some documentation of this new feature? It sounds
Just be aware of dialyzer "feature" which is it recognizes only
"-behavioUr" attribute spelling not "-behaviOr" - if you have some of
the latter you end up cleaning your code from "-behavior" replacing with
"-behaviour" or manually fix the code in dialyzer_behaviors.erl file,
line 78 and recompile.
More information about the erlang-questions