[Fwd: Re: [go-nuts] Re: Generics false dichotomy]

Tobias Pankrath tobias at pankrath.net
Tue Feb 18 04:13:54 PST 2014


On Tuesday, 18 February 2014 at 07:45:10 UTC, Paulo Pinto wrote:
> It is like traveling back in time when parametric polymorphism 
> was debated in university papers and everyone was inventing 
> their own code generation tool.
>
> We are in 2014, not in the early 90's. So to ignore what 
> happened in mainstream language design in the last 20 years, is 
> nothing more than an opinionated political decision against 
> generics.

I have a hard time to subsume D's type system under parametric 
polymorphism, while I see how Javas generics may be. This may 
just be way over my head, but I'd rather say D has a 
sophisticated way of ad-hoc polymorphism that provides ways to 
generate overloads on demand, contrary to the wikipedia statement 
that ad-hoc only allows for a fixed amount of overloads.

> Thus, ad hoc polymorphism can generally only support a limited 
> number of such distinct types, since a separate implementation 
> has to be provided for each type. [1]

I'd say inout is a example of parametric polymorphism in D.

[1] http://en.wikipedia.org/wiki/Parametric_polymorphism


More information about the Digitalmars-d mailing list