Transient ranges

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 13 17:19:54 PDT 2016


On 06/12/2016 04:46 AM, Dicebot wrote:
> That is matter of design philosophy. For me such basic library
> primitives warrant C++ attitude of "don't pay for what you don't ask
> for" - and everything else, including actual feature completeness, is of
> negligible importance compared to that.

C++'s input iterator model also predicates multiple accesses to the 
current value by means of *it.

> If keeping random access for map requires either caching or multiple
> evaluations of predicate, I want it to be banned by default and
> enabled explicitly (not sure what could be good API for that though).

In the initial implementation, map did cache the current element. That 
made some folks unhappy, so it was removed. In lieu, a function "cache" 
was introduced. Apparently this setup makes other folks unhappy.

It seems to me, sometimes if I went by what this forum agrees upon I'd 
write one thousand lines of code one day and remove it the next.

> Phobos indeed doesn't seem to make such priorities right now and that is
> one of reasons I am growing increasingly unhappy with it.

What steps do you think we could take with Phobos to make it better 
without breaking backward compatibility?


Andrei



More information about the Digitalmars-d mailing list