On 2014-02-26 16:05:19 +0000, Steve Teale said:

On Wednesday, 26 February 2014 at 13:30:15 UTC, Leandro Motta Barros wrote:
Hello,

I'm coming late to the discussion, but I believe that you can use the
following idiom to achieve the same results in a different way:

Yes we went through that, if you go back a page you'll find a post I did that makes the thing work better using a class variable in the base class that is an array of delegates.

That way you don't have to do super, super, super back to root, you just have to iterate over the delegates until you find one that accepts the command.

It does just what I wanted to do in the first place without compiler assistance
  ;=).

Steve

Actually, D has the ability to walk the object hierarchy at compile time, and generate a function call containing all the super classes's handleCommands. You could also even tag them with an attribute structure to list which command #'s they accept to be able to generate a switch, or bunch of if's to avoid function calls.

-S.

Reply via email to