extending standard behaviours

Chris Pressey cpressey@REDACTED
Tue Apr 16 23:13:36 CEST 2002


Sean Hinde wrote:
>I fear we are straying a bit close into OO land here, but perhaps there is
>something useful to steal from those guys??

It's called the 'specialization' relationship, and they stole it from *us*,
split it in two, and renamed it 'inheritance' and 'instantiation' :)

Seriously, though... subclassing, and implementing a behaviour
('behaving'?), are the same idea (design pattern) in two different realms.

Fido 'IS-A' dog, which 'IS-A' animal.

my_specific_fsm_timer 'IS-A' gen_fsm_timer, which 'IS-A' gen_fsm.

I wish I could explain this better, but I guess it's so intuitive to me that
it's difficult to put into words.  Basically I don't see much difference,
maybe no real difference at all, between an Erlang behaviour and a Java
interface.  The difference is that the behaviour is specified in terms of
callback functions instead of properties of an object, but this is (to me)
such a small distinction as to be easily dismissed, since functions can do
the work of object properties and/or methods.

Chris





More information about the erlang-questions mailing list