Your own behaviours

Sean Hinde <>
Fri Sep 21 14:26:58 CEST 2001


That's excellent news, thank you!

Sean

> -----Original Message-----
> From: Gunilla Hugosson [mailto:]
> Sent: 21 September 2001 13:07
> To: 
> Subject: Re: Your own behaviours
> 
> 
> Hi,
> 
> This feature has now been added to Erlang/OTP R8 according to
> an implementation proposal made by Ulf Wiger. Release note:
> 
> 	It is now possible to have the compiler check user-defined
> 	behaviours and not only the pre-defined OTP behaviours
> 	(gen_server etc.).
> 
> 	This is done by adding a function behaviour_info/1 to
> 	the behaviour module. behaviour_info(callbacks) should return
> 	a list of {FunctionName,Arity} which defines the callback
> 	functions the behaviour uses.
> 
> 	When a callback module with the attribute
> 	  -behaviour(Behaviour).
> 	is compiled, its exported functions will be compared with
> 	the list returned by Behaviour:behaviour_info(callbacks) and
> 	a warning will be issued if any callback function is missing.
> 
> 	Note that the user must ensure that the module Behaviour is
> 	present at compile-time and can be found in the current code
> 	path.
> 
> Best regards, Gunilla
> 
> 
> 
> Lennart Öhman wrote:
> 
> > Hi!
> > 
> > Mandatory callback functions, among other things, are defined
> > in the module otp_internal. This module is used when compiling
> > modules having -behavior attribute.
> > 
> > If you wish to extend your OTP with your own behaviors, otp_internal
> > must (should) be changed.
> > 
> > My suggestion is that the functions in the otp_internal are 
> changed to
> > look for the "answers" in the generic module corresponding
> > to the behaviour at hand. In this way you do not need to change
> > modules belonging to the original system. But instead only program
> > a set of required functions in any new behaviour you invent.
> > 
> > Best Regards,
> > 
> > Lennart
> > 
> > -------------------------------------------------------------
> > Lennart Ohman                   phone   : +46-8-587 623 27
> > Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
> > Sehlstedtsgatan 6               fax     : +46-8-667 8230
> > SE-115 28 STOCKHOLM, SWEDEN     email   : 
> 
> -- 
> _____Gunilla Hugosson____________________________________________
> Project Manager, Erlang/OTP
> Ericsson Utvecklings AB, UAB/S/P OTP Product Development
>   +46-8-7275730
> 



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.





More information about the erlang-questions mailing list