Extending Functionality: gen_server_ext
    Chris Pressey 
    cpressey@REDACTED
       
    Fri Mar 21 20:04:18 CET 2003
    
    
  
On Fri, 21 Mar 2003 11:22:01 +0100
"Vlad Dumitrescu (EAW)" <Vlad.Dumitrescu@REDACTED> wrote:
> Hello,
> 
> > From: Jay Nelson [mailto:jay@REDACTED]  
> >Chris and Vlad discussed:
> >> Extensions to gen_server to support "behavers" and pseudo
> >> inheritance call chains ...
(aside: just to clarify: "behaver" is not a new thing, it's a coined term
for "a module which implements a behaviour"... which Erlangers write every
day, but don't seem to have a non-specific word for - they tend to use
the name of the specific behaviour that they're implementing as in "I've
written a gen_server" rather than "I've written a behaver for
gen_server")
> [...]
> What I'd like to be able to do is create a process by specifying
> several interfaces/behaviours it will support, a GUI related example
> might be for a button: I need let's say 'drawable', 'clickable',
> 'mouse_over'. Just by naming them, I get the functionality,
  -module(my_button).
  -behaviour(drawable).
  -behaviour(clickable).
  -behaviour(mouse_over).
?
> and I can
> (if I want) to override some of the functionality to better suit the
> button's needs.
  before_draw(Button) ->
    % arbitrarily don't draw the button if it's on the right side
    case x(Button) of
      X when X > screen_width() / 2 ->
        cancel;
      _ ->
        ok
    end.
?
> Potential problem: how to ensure that these behaviours do not have
> overlapping interfaces? (i.e. message tags or callback names that are
> the same)
Prepend a tag?
-Chris
    
    
More information about the erlang-questions
mailing list