Proposal: takeFront and takeBack

Jonathan M Davis jmdavisProg at gmx.com
Wed Jul 4 01:40:30 PDT 2012


On Wednesday, July 04, 2012 10:25:18 Mehrdad wrote:
> On Wednesday, 4 July 2012 at 08:13:20 UTC, Tobias Pankrath wrote:
> > The name must imply that the range will be changed, i.e. after
> > the call the value is not part of the range anymore.
> > 
> > consume does this, fetch does this, too. read does not
> 
> Where have you last ever seen a read() method whose default
> behavior was NOT to modify the
> collection/range/iterator/stream/whatever?

It depends on the API. All that the word read indicates is that data was read. 
It doesn't indicate anything about what was read from or what happened to it. 
In some cases, read doesn't alter what's read at all. In others it does.

There's an iterator type that I deal with at work which uses read to indicate 
that a value was read but the iterator wasn't moved, and it uses consume to 
indicate that not only was the value read but that the iterator was moved.

- Jonathna M Davis


More information about the Digitalmars-d mailing list