Revised RFC on range design for D2

Pablo Ripolles in-call at gmx.net
Fri Sep 12 08:38:28 PDT 2008


Andrei Alexandrescu Wrote:

> Bill Baxter wrote:
> > On Fri, Sep 12, 2008 at 11:39 PM, Andrei Alexandrescu
> > <SeeWebsiteForEmail at erdani.org> wrote:
> >> Pablo Ripolles wrote:
> >>> What about "isDone"?
> >> isDone is great, I just wanted to keep the one-word streak going. Let's see
> >> what everyone else says.
> > 
> > Hmm.  std.algorithm does have an "isSorted" function.  So I guess I
> > agree it would be more consistent if you call it isDone or isEmpty.
> > 
> > Or rename "isSorted" to "sorted".  :-)  But then you have to face the
> > consequences later when you want to have a predicate that is ambiguous
> > without the "is".    Probably a lot of noun predicates are in that
> > category -- i.e. checking  isSomeNoun(x).  Like "isRange(x)" to see if
> > x is a range.  That would have to just become "range(x)" which is a
> > bit ambiguous.
> > 
> > So I agree. Stick the "is" in there.
> 
> Thing is, people will call isSorted much less often than (isD|d)one. In 
> std.algorithm clearly the one-word paradigm can't scale. But for a 
> handful of heavily-used names I'd be willing to take the Pepsi challenge.
> 
> Andrei
> 
> P.S. The more I think of it, the more I like "tip" of the range. Short, 
> poignant, easy to remember. Not pressing the red button just yet.

brilliant! I think "tip" is just fantastic!

"head" and "tip" wonderful couple.

yes, *this* one is as neutral as it can be! besides, the tip of something is unique! if you hold something by its toe, which one of how many are you holding? :)

when I name boolean identifiers, I kind follow these "rules":

*properties:
the instance is the grammatical subject, so it is very natural to use "is" as in self.isDone

*scalar variables:
I tend to append the "whether" as in whetherDone

*array variables:
here you have that the index to access the value is related to the grammatical subject, then I use something as visited[i]

*functions:
here you have that the argument to be passed to the function might be the grammatical subject, then I use something as searched(x) or pointIsInCell(P, C)

Its always nice that a std library is as regular as it can be, perhaps as your own library.  for special, particular words we already have the keywords, right?

Cheers!




More information about the Digitalmars-d-announce mailing list