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 and >>> return $(D false). >>> */ >>> bool startsWithConsume(R1, R2)(ref R1 r1, R2 r2); >>> ======================= >>> >>> 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: findConsume, consumeFind. >>> >>> >>> Andrei >> >> I thought that that was basically what chompPrefix did, and chompPrefix >> seems like a great name to me, but I guess that that's not entirely >> generalizable: chompFind or findChomp would be a bit weird. Consume seems >> like the best of the ones that you suggested. It is explicitly what >> you're doing. It's a bit long, but the others aren't as clear. Other >> suggestions might be erase or remove, since you appear to be >> erasing/removing elements from the range. Consume is probably better >> though. >> >> - Jonathan M Davis >> >> P.S. You could also go for startsWithFineDiningWithAFourCourseMeal. >> People would absolutely love _that_ function name. ;) > > 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 several people's "obviously good" naming schemes and > conventions quickly falls to zero as the size of the group increases. > > Andrei
Yeah, but everybody does agree that consistency is the overriding concern. There is still consistency to be gained between std.file / std.string / std.algorithm etc. (more so than in std.algorithm itself). Consistency is hard though, because you have to make up rules for something that is connected to natural language, and a messy one too. Luckily english has a freaking huge vocabulary :) On a related note, thanks for reordering take's parameters.