A D vs. Rust example

Timon Gehr timon.gehr at gmx.ch
Thu Oct 20 18:01:37 UTC 2022


On 10/20/22 18:49, H. S. Teoh wrote:
> On Thu, Oct 20, 2022 at 03:25:36PM +0000, Don Allen via Digitalmars-d wrote:
>> 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.
> [...]
> 
> It would be good to file these as enhancement requests to bugzilla, so
> that they don't get lost in the dusts of forum history.
> 
> 
> T
> 

Such warnings don't carry over well to D though, because template 
expansion is untyped. Therefore, by default the compiler will check 
whether the _generated code_ has any of those issues, which is usually 
just an annoyance. Lots of false positives. I also don't think people 
should be encouraged to remove unnecessary parentheses, otherwise they 
will start to also omit necessary ones.


More information about the Digitalmars-d mailing list