Why does D not have generics?

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Sat Jan 16 06:57:53 UTC 2021


On Saturday, 16 January 2021 at 06:33:13 UTC, Bruce Carneal wrote:
> It sounds like mappings to arbitrary precision big endian 
> unsigned is where you're headed currently.

More like converting to ulong snd ucent. But CPUs have 
instructions for endian conversion so that is ok. Converting from 
signed to unsigned is just one add.

> Implementing relop-unifying xforms to whatever form you 
> actually choose should not be difficult.  You have the types in 
> hand so you're looking at a specialized binary serialization 
> problem.  Coming back out again is trickier I think.

I think most conversion will only take 1-4 cycles. The advantage 
is that once everything is uniform you can use handcoded SIMD in 
the container algorithms, which would be too much work 
otherwise... Dunno if the trade off is worth it,but it might?

Btw, one challenge for getting compiler level type erasure is 
that function addresses cannot be used for type identity, maybe a 
language spec issue?




More information about the Digitalmars-d mailing list