www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Re: Revised RFC on range design for D2

reply Pablo Ripolles <in-call gmx.net> writes:
Bill Baxter Wrote:

 On Sat, Sep 13, 2008 at 12:03 AM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 Bill Baxter wrote:
 On Fri, Sep 12, 2008 at 11:39 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail 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.

Hmm. One semantic issue I have is that the tip usually refers to the infinitessimal point at the end. Not a thing with substance. I'm having trouble feeling like I'm going to get an item back when I look at "x.tip". Head has huge history being used for the item at the front of a list, so I think that's much less likely to cause anyone looking at D code to scratch their heads. It will be obvious what it means even in relative isolation. head/tip will often appear without "toe" in forward range algos. So you need to be able to easily recognize what "tip" means without seeing that "toe" to give context. Toe on the other hand will probably almost always appear with his mate. Ooh, another scale thing, but a head is obviously a very different scale than a toe. A foot is closer to the same scale. Maybe head/foot is better than head/toe. The connection between retreating / feet is stronger that retreating / toes, too! --bb

After having had some sleep, I kind of support Bill's proposal, that is, head/foot, definitely better than head/toe. It's like the header and the footer! sounds very reasonable. Of course I also like fore/aft, but thats because my aeronautical engineering bias. tip is too ambiguous. tail refers to all what comes after the head, not to its tip. Cheers!
Sep 13 2008
next sibling parent reply Michel Fortin <michel.fortin michelf.com> writes:
On 2008-09-13 04:18:20 -0400, Pablo Ripolles <in-call gmx.net> said:

 After having had some sleep, I kind of support Bill's proposal, that 
 is, head/foot, definitely better than head/toe.  It's like the header 
 and the footer! sounds very reasonable.  Of course I also like 
 fore/aft, but thats because my aeronautical engineering bias.
 
 tip is too ambiguous.
 
 tail refers to all what comes after the head, not to its tip.
 
 Cheers!

Anyone suggested head/rear yet? -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Sep 14 2008
parent Pablo Ripolles <in-call gmx.net> writes:
Michel Fortin Wrote:

 On 2008-09-13 04:18:20 -0400, Pablo Ripolles <in-call gmx.net> said:
 
 After having had some sleep, I kind of support Bill's proposal, that 
 is, head/foot, definitely better than head/toe.  It's like the header 
 and the footer! sounds very reasonable.  Of course I also like 
 fore/aft, but thats because my aeronautical engineering bias.
 
 tip is too ambiguous.
 
 tail refers to all what comes after the head, not to its tip.
 
 Cheers!

Anyone suggested head/rear yet?

Hello, if I remember well, yes. I also like it! I don't recall the argument against it though...
Sep 14 2008
prev sibling parent "Bill Baxter" <wbaxter gmail.com> writes:
On Sun, Sep 14, 2008 at 9:29 PM, Pablo Ripolles <in-call gmx.net> wrote:
 Michel Fortin Wrote:

 On 2008-09-13 04:18:20 -0400, Pablo Ripolles <in-call gmx.net> said:

 After having had some sleep, I kind of support Bill's proposal, that
 is, head/foot, definitely better than head/toe.  It's like the header
 and the footer! sounds very reasonable.  Of course I also like
 fore/aft, but thats because my aeronautical engineering bias.

 tip is too ambiguous.

 tail refers to all what comes after the head, not to its tip.

 Cheers!

Anyone suggested head/rear yet?

Hello, if I remember well, yes. I also like it! I don't recall the argument against it though...

I think it was that if you're thinking body parts, then "rear" means someone's bottom. There's an expression -- "get your head out of your rear" -- that comes to mind. --bb
Sep 14 2008