Dispatching values to handlers, as in std.concurrency

"Luís "Luís
Mon May 6 17:15:04 PDT 2013


On Monday, 6 May 2013 at 23:53:51 UTC, Idan Arye wrote:
> If the type handlers are your own classes, then you can let 
> them check it. Have a method in the handlers that check if an 
> object can be handled by that handler, and use it on each 
> handler until you find one that fits.

I don't understand. Imagine I have:

     class X
     {
         void handleFoo(Foo msg) { ... }

         void handleBar(Bar msg) { ... }
     }

I want to register an instance of X to receive messages of type 
Foo (or subclass) and messages of type Bar (or subclass) in the 
respective handler methods. Where are you proposing for your 
check to be implemented?


More information about the Digitalmars-d-learn mailing list