Why does D not have generics?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jan 11 18:30:19 UTC 2021


On Monday, 11 January 2021 at 18:23:20 UTC, Q. Schroll wrote:
> I don't want to be mistaken. I know what the differences of 
> generics (cf. Java, C#) are and what templates (cf. D, C++) 
> are. Maybe my question has obvious answers and I just don't see 
> them.
>
> The only programming language I know of that has both, 
> templates and generics, is C++/CLI and ones closely related.

I think you are really talking about generics in Java and is 
interpreting the semantic landscape through that lense?

There are many variations:

https://en.wikipedia.org/wiki/Generic_programming

C++ "concepts" is to a large extent syntactical sugar that makes 
it easier to specify interfaces... so I don't think it has a 
significant semantic impact. Mostly a usability impact.


More information about the Digitalmars-d mailing list