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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jun 14 14:23:24 UTC 2021


On Monday, 14 June 2021 at 14:10:48 UTC, jfondren wrote:
> What this presentation does well is to add nuance to these "X 
> is just
> better than Y" relationships. Some tasks are trivial for C++ 
> but a
> hassle for D, and surprisingly many tasks are excluded by Rust's
> iterators.

But then he should have focused on concrete complex algorithms 
and how one approach makes the algorithm much harder to read or 
some other usability measure.

But C++ didn't have iterators until C++20, they had table 
pointers/cursors (which they wrongly call "iterators").

> I'd also never noticed std.algorithm.cache until I went 
> searching for
> a library solution that I was sure must exist for the "filter 
> calls
> map's function twice" problem that D has, but Rust doesn't have.

I think C++ may gain an edge with concepts. D will eventually 
need something similar and make it easier to write composable 
template libraries.

By composable I mean that you compose new types applying 
templates to templates to templates. Right now, this is not 
really possible in D because of the type unification issue.

If C++ library authors succeed in making good use of such 
features, they might gain an edge.

BUT the D community is much smaller, so it should in theory be 
much easier for the D community to develop "standards" for 
creating composable template libraries.

So even though C++ may have an edge right now, they also have a 
bigger hurdle to overcome for establishing eco system "standards".

D needs to capitalize on being small and improve template 
composability between libraries, IMO.




More information about the Digitalmars-d mailing list