Boost logo

Boost Users :

Subject: Re: [Boost-users] [intrusive] first impression and constant-time removal
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2009-02-05 10:43:46


On Thu, Feb 05, 2009 at 06:44:19AM -0800, Erik Cassel wrote:
>
> 1) I found the remove() function's name ambiguous. It isn't clear that the
>
It fully agrees with the use of the remove() name in the standard <algorithm>
header. Calling it something else would break the convention and introduce
unnecessary extra learning effort for people acquainted with the standard
library.

I am actually replying to add item 4: iterator_to is an extremely unintuitive
and little informative name which I'm continually stumbling over. The
convention is to name the functions according to what they return, so
"to_iterator" or "get_iterator" or "iterator_of"[1] would make much more
sense.

But I guess it's too late to complain about that "bug" now that the library has
undergone review and gotten accepted...

[1] Note how "iterator_of" is declarative, indicating return value, whereas
"iterator_to" is imperative and leads the reader to expect that something will
be done with the iterator that is passed in as argument (compare with functions
of similar names than one encounters, e.g. "fixed_string_to_int", which takes
string as a source argument; functions returning X are conventionally named
to_X -- e.g., browse through DateTime library [just a random example]).

I see the logic behind a statement like iterator_to(X), but each time I have to
use that function, I have to stop, think twice and assure myself that the
naming logic really is the opposite of the convention and that the function
really does what I need.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net