Iterators and Ranges: Comparing C++ to D to Rust

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jun 15 09:20:12 UTC 2021


On Tuesday, 15 June 2021 at 08:22:07 UTC, Petar Kirov 
[ZombineDev] wrote:
> That said, no matter how easy is to show that innocent looking 
> code can end up with an iterator invalidation bug, in practice 
> I don't remember ever experiencing it in my D code. Resisting 
> the urge to mutate a container while you're iterating is really 
> not that hard :D

I agree. If D wants to be a system level programming language it 
should take some of the disadvantages that comes with making it 
easy to write performant code.

It would be better to focus on making it easier to write static 
analysis linters for D, by making it possible to emit a high 
level IR after templates have been expanded.

There are tools that take a "generic programming language" as 
input and makes it possible to write various custom checks over 
that language. So what is needed is a way to translate 
template-expanded D code to such "verification languages".

Limited resources do suggest that one should leverage existing 
generic tools.

Lots of unused opportunities there, I think.



More information about the Digitalmars-d mailing list