bearophile wrote: > According to the paper from Bjarne Stroustrup: > http://www.research.att.com/~bs/multimethods.pdf > > this is a possible syntax D3 can use for the double dispatch: > void foo(@virtual A a, @virtual B b) {} > > Bye, > bearophile
I have studied this paper a bit once, it's good. It also shows that their multimethod implementation is faster than the visitor pattern. I would love to never see a visitor pattern again, it really sucks compared to multimethods. I think we can first try to make a multimethods library, and we need only one addition to __traits ( to get the overloads of free / static functions) for *open* multimethods. I tried it once but found it not that easy. It should be possible to have a (perhaps slow) proof of concept that rivals the python example you gave in conciseness.