Isn't using find with retro awkward?

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 14 21:36:32 PST 2011


On Monday 14 February 2011 21:14:18 Andrej Mitrovic wrote:
> On 2/15/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> > Of _course_ you get a reversed range back. You _reversed the range_.
> > That's what
> > retro _does_. If you use it with find, of _course_ you're going to get a
> > reversed
> > range back. Complaining about that is like complaining that your range is
> > sorted
> > after you sorted it. It did exactly what it's supposed to do.
> 
> You're not reading my posts properly. I /know/ that. That's why I've
> put a comment there that using retro doesn't make sense. Sheesh!
> 
> My concern is that in the documentation it states "if you want to find
> the last match use retro". I believe this can bite newcommers to D if
> they don't know the fact that they'll get back a reversed range. It
> just says "use retro", it doesn't mention what retro does. It does
> link to it, that's okay, but will people read the retro documentation
> or will they just jump to conclusions and think retro does its magic
> and find just returns a range as usual?
> 
> Regardless of that documentation, I'm thinking lastFind might be of
> use. But I'd like to hear more opinions before I blindly open a
> feature request.

If the documentation says that you should use retro, then it needs to be very 
clear about it. Personally, I'd suggest that you just open an enhancement 
request. Either Andrei will do something about it (since he's almost certainly 
the one who would) or he won't. But I can pretty much guarantee that there will 
be other people who will want it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list