A D vs. Rust example

Don Allen donaldcallen at gmail.com
Thu Oct 20 15:25:36 UTC 2022


Where I do think D would do well by emulating Rust is in the area 
of helpful compiler warnings: noting unused variables, constants 
and imported symbols, pointing out unnecessary parentheses, etc.

I do realize that Walter has emphasized compilation speed in dmd 
and that is a worthy goal. In pursuit of that, some of what I'm 
suggesting may not be possible with dmd's current level of 
analysis of the source code. But to the extent that tradeoff 
exists, I'd suggest re-thinking it. The Rust compiler is much 
slower than dmd, but I personally did not find its speed (or lack 
thereof) to be a big issue for me while I was doing Rust 
development (on contemporary hardware with ~4ghz processors, 32 
GB of memory and an NVME SSD). Perhaps there's a cake-and-eat-it 
solution that would make the additional analysis and resulting 
warnings optional, so those running on old hardware or care more 
about compilation speed than the warnings could have it their way 
too.



More information about the Digitalmars-d mailing list