Please vote once and for good: range operations

Michel Fortin michel.fortin at michelf.com
Thu Jan 29 18:11:02 PST 2009


On 2009-01-29 00:02:20 -0500, Bill Baxter <wbaxter at gmail.com> said:

> On Thu, Jan 29, 2009 at 1:51 PM, Andrei Alexandrescu
> 
>> That's a good point, but... we are at liberty to choose ANY names we please.
>> Is this weird "first"/"next" combo our best shot?
> 
> But unless you've got some new words to add, we've listed pretty much
> every reasonable pair, and they all have issues of similar magnitude
> (or at least which some fraction of people will declare is of similar
> magnitude...)

I think "first/last" goes well with "advance/retreat".

Note how "advance" is a natural word in this context... quoted from the 
"What's the deal with __buck?" thread, Andrei says: "Now consider I 
want to advance 10 steps in that range."... yet, he wants to name the 
function "next".

Not only that, but the word "advance" is used everywhere Andrei's 
documentation for std.range, whenever it talks about "next"... some 
quotes:

"isInputRange: r.next advances to the next element in the range."

"struct Radial(R): void next(); Range primitive operation that advances 
the range to its next element.

This one's funny:
"Range drop(Range)(size_t n, Range r): Eagerly advances a copy of r n 
times (by calling r.next n times)"

"struct SListRange(T,Topology topology = Topology.flexible): void 
next(); Range primitive operation that advances the range to its next 
element."

"struct Zip(R...): void next(); Advances to the next element in all 
controlled ranges."

Unfortunately there is no definition for "retreat" to compare with.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list