Why no multiple-dispatch?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 25 06:06:39 PDT 2014


On Monday, 25 August 2014 at 10:16:29 UTC, Aerolite wrote:
> Well there are a few go-to use-cases, the handling of collisions
> between objects in a game-engine being the most well-known 
> (which
> requires Double-Dispatch).

I think a game engine is better off using a simple table or a 
more homogeneous engine based on properties rather than classes. 
You usually can assign a small integer to the relevant properties 
and use a 2D LUT.

> D, at least in my experience, tends to solve a
> lot of these shortfalls, and given that design path, why
> *wouldn't* we want Multiple Dispatch in the language?

I have never had a need for it, but maybe I would have used it if 
it was available.

I think, however, that it would fit better in Go which are going 
for a more "dynamic" implementation of interfaces without OOP.

I certainly see some value in detaching virtual functions from 
the record definition. I believe bitC might go in that direction 
as well.


More information about the Digitalmars-d-learn mailing list