Please vote once and for good: range operations

Denis Koroskin 2korden at gmail.com
Thu Jan 29 05:06:09 PST 2009


Vladimir Panteleev Wrote:

> On Thu, 29 Jan 2009 06:25:58 +0200, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
> > Simen Kjaeraas wrote:
> >> Andrei Alexandrescu wrote:
> >>
> >>> So please let's vote once and for all.
> >>>
> >>> Andrei
> >>  Do let's. My first vote goes to first/last, with head/toe at second  
> >> place.
> >>  -- Simen
> >
> > Ok, after looking at my code I discovered a huge problem with "first".  
> > ("Last" is cool.) If all you do is implement them and use them with  
> > foreach, fine. But if you need to call them manually (which is the case  
> > sometimes), you get really badly interacting terms there. Look at this,  
> > taken from real code (the filter function):
> >
> > while (!_input.empty && !pred(_input.first)) _input.next;
> >
> > I can see the putative user scratching their head: "Ok, so I start  
> > iteration with the first element, then I move to the next one... but  
> > then why the heck am I looking at the first again?"
> >
> > "First" must go.
> 
> I don't think that "next" is an appropriate name here. Since it is an  
> action, it should be named as one - "next" sounds more like a function  
> (which doesn't modify the instance). Have you considered "forward"?
> 
> -- 
> Best regards,
>   Vladimir                          mailto:thecybershadow at gmail.com

Agree, "advance" would be a better name, though (imo).



More information about the Digitalmars-d mailing list