Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-22 Thread Lutger
Andrei Alexandrescu wrote: > Jonathan M Davis wrote: >> Andrei Alexandrescu wrote: >> >>> I also defined recently: >>> >>> === >>> /** >>> If $(D startsWith(r1, r2)), consume the corresponding elements off $(D >>> r1) and return $(D true). Otherwise, leave $(D r1) unchanged an

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-21 Thread Philippe Sigaud
On Sat, Feb 20, 2010 at 21:48, Andrei Alexandrescu < seewebsiteforem...@erdani.org> wrote: > To focus the discussion about naming conventions, let's discuss one > particular aspect. Right now we have in std.algorithm: > (snip) > There are a few other functions like that: one version takes a range

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Jonathan M Davis
Oh, and while some names seem odd at first, they can definitely grow on you. For instance, I thought that retro was quite odd at first, but I'm definitely starting to like it. I would have suggested reverse (which I guess was out due to arrays), or maybe rev, but retro is shorter than reverse a

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Adam D. Ruppe
On Sat, Feb 20, 2010 at 02:48:10PM -0600, Andrei Alexandrescu wrote: > bool startsWithConsume(R1, R2)(ref R1 r1, R2 r2); I rather like that. I didn't at first, but I tried think of alternatives and everything came up short. Consume() it a nice, short way of saying "if , consume ". It

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Jonathan M Davis
> Heh. > > Overall the problem of choosing names by consensus is that the > intersection is withering real fast. I agree 80% with Kenny's and > Michel's choices. Others also seem to agree about the same percentage. > The problem is that nobody agrees on the _same_ 80%. The net > intersection of se

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Michel Fortin
On 2010-02-20 19:12:21 -0500, Andrei Alexandrescu said: But how about others? What is the overall convention? In my module the convention was to always start the name with "consume". I had "consumeOneChar" with a predicate checking one character, "consumeOneString" for matching specific st

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Andrei Alexandrescu
Jonathan M Davis wrote: Andrei Alexandrescu wrote: I also defined recently: === /** If $(D startsWith(r1, r2)), consume the corresponding elements off $(D r1) and return $(D true). Otherwise, leave $(D r1) unchanged and return $(D false). */ bool startsWithConsume(R1, R2)

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-02-20 15:48:10 -0500, Andrei Alexandrescu said: To focus the discussion about naming conventions, let's discuss one particular aspect. Right now we have in std.algorithm: === /** If the range $(D doesThisStart) starts with $(I any) of the $(D

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Jonathan M Davis
Andrei Alexandrescu wrote: > I also defined recently: > > === > /** > If $(D startsWith(r1, r2)), consume the corresponding elements off $(D > r1) and return $(D true). Otherwise, leave $(D r1) unchanged and > return $(D false). > */ > bool startsWithConsume(R1, R2)(ref R1 r

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Michel Fortin
On 2010-02-20 15:48:10 -0500, Andrei Alexandrescu said: To focus the discussion about naming conventions, let's discuss one particular aspect. Right now we have in std.algorithm: === /** If the range $(D doesThisStart) starts with $(I any) of the $(D withOneOfThese) range

Re: "Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrei Alexandrescu wrote: > There are a few other functions like that: one version takes a range by > value, the other takes it by reference and alters it. > > The question is, what is a good naming convention for expressing that? > Other examples: f

"Consume", "Skip", "Eat", "Munch", "Bite", or...?

2010-02-20 Thread Andrei Alexandrescu
To focus the discussion about naming conventions, let's discuss one particular aspect. Right now we have in std.algorithm: === /** If the range $(D doesThisStart) starts with $(I any) of the $(D withOneOfThese) ranges or elements, returns 1 if it starts with $(D withOneOfThes