| Thread overview | |||||
|---|---|---|---|---|---|
|
January 04, 2008 Open Multi-Methods article | ||||
|---|---|---|---|---|
| ||||
The "lambda the ultimate" blog often shows interesting articles: "Open Multi-Methods for C++", by Peter Pirkelbauer, Yuriy Solodkyy, and Bjarne Stroustrup: http://lambda-the-ultimate.org/node/2590 http://www.research.att.com/~bs/multimethods.pdf They seem fast enough too. Bye, bearophile | ||||
January 05, 2008 Re: Open Multi-Methods article | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Fri, 04 Jan 2008 12:34:05 -0000, bearophile <bearophileHUGS@lycos.com> wrote:
> The "lambda the ultimate" blog often shows interesting articles:
>
> "Open Multi-Methods for C++", by Peter Pirkelbauer, Yuriy Solodkyy, and Bjarne Stroustrup:
> http://lambda-the-ultimate.org/node/2590
> http://www.research.att.com/~bs/multimethods.pdf
>
> They seem fast enough too.
>
> Bye,
> bearophile
Support for multi-dispatch is one thing I'm hoping to see in a future iteration of D.
To summarise the paper they propose a syntax for open methods (which are free functions)
as opposed to multi-methods using virtual as an argument qualifier.
bool intersect(virtual Shape&, virtual Shape&); // open−method
bool intersect(virtual Rectangle&, virtual Circle&);
This doesn't look a bad solution for either C++ or D2.x/3.x.
| |||
January 06, 2008 Re: Open Multi-Methods article | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bruce Adams | Bruce Adams wrote:
> On Fri, 04 Jan 2008 12:34:05 -0000, bearophile <bearophileHUGS@lycos.com> wrote:
>
>> The "lambda the ultimate" blog often shows interesting articles:
>>
>> "Open Multi-Methods for C++", by Peter Pirkelbauer, Yuriy Solodkyy, and Bjarne Stroustrup:
>> http://lambda-the-ultimate.org/node/2590
>> http://www.research.att.com/~bs/multimethods.pdf
>>
>> They seem fast enough too.
>>
>> Bye,
>> bearophile
>
> Support for multi-dispatch is one thing I'm hoping to see in a future iteration of D.
> To summarise the paper they propose a syntax for open methods (which are free functions)
> as opposed to multi-methods using virtual as an argument qualifier.
>
> bool intersect(virtual Shape&, virtual Shape&); // open−method
> bool intersect(virtual Rectangle&, virtual Circle&);
>
> This doesn't look a bad solution for either C++ or D2.x/3.x.
I prefer the MultiJava syntax meself:
boolean intersect(Shape s1, Shape s2);
boolean intersect(Shape@Rectangle s1, Shape@Circle s2);
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply