Why does D not have generics?

Petar Petar
Tue Jan 12 13:20:06 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.
> [...]

I agree with everything you said. Even though I greatly enjoy 
DbI, many times I miss C# generics and TypeScript's powerful, yet 
fully-erased typing. Type-checking has been described as the most 
successful form of light-weight formal verification and some of 
my TypeScript usage feels like this (compared to using pure 
Sometimes I don't need **or want** different code to be generated 
depending on the generic parameters, I just want the type system 
semantics and the light-weight formal verification (e.g. 
implementing units of measure).

More information about the Digitalmars-d mailing list