map! filter! and range algorithm
bearophile
bearophileHUGS at lycos.com
Tue Mar 5 19:25:33 PST 2013
H. S. Teoh:
> A range is an abstraction akin to C++'s iterators (except
> better, IMO).
Stepanov himself has commented very briefly about Alexandrescu/D
Ranges in one of his video lessons. I have not fully understood
what Stepanov has said with those few words spoken in a not so
good English (not because of language, but because Stepanov is
still out of my league, he's a Teacher) but I think he has
dismissed the Ranges. A bit like a chemist would dismiss a person
that says that molecules are more important than atoms and only
molecules should be used.
I think he has said that atoms are there (in a kind of
mathematical Platonism), even if you try to ignore them, they are
more fundamental. So Ranges are a little abstraction over
C++-style iterators. They are maybe more handy, safer, they allow
you to reason at a a bit higher lever, but they also forbid you
to do few of the useful things that iterators can do.
In the end I think ranges were a success for D. Almost every part
of the design of D has problems; sometimes even large problems
(like shared, problems with missing head and tail const, missing
logic constness, problems with scope, and so on at nauseum), but
most times D ranges work, despite some faults they have.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list