Subject: Re: [PATCH 00/86] replace prefixcmp() with has_prefix()

From: Junio C Hamano <[email-masked]>
Date: Tue, 12 Nov 2013 13:26:00 -0800

Christian Couder <[email-masked]> writes:

> From: Junio C Hamano <[email-masked]>
>> 
>> Even though we already added has_suffix() for tail matches, it is
>> not too late to rethink, as it is not in 'master' yet.
>> 
>> One thing I noticed is that it is probably misnamed, or at least in
>> a way that invites confusion.  Can people tell which one of these is
>> correct without looking at existing callsites?
>> 
>>         has_suffix(filename, "txt");
>>         has_suffix(filename, ".txt");
>> 
>> The semantics of the function we have is the latter and is better
>> called endswith(), I suspect.  And the corresponding function to
>> check for head matches should probably be called beginswith().
>
> I don't know if has_suffix() is confusing for a native speaker.
>
> After a look at some languages, Python has "startwith()" and
> "endswith()", and Java has "startWith()" and "endsWith()".
>
> But while we are at it, why not
> "ends_with()" and "begins_with()"? To me using an underscore seems
> more consistent with what we are doing in Git.

Sure.

I do not think Peff and I were discussing at that level yet to
debate between camelCase and words_with_underscore.  We were mainly
talking about what words to be used, which needs to come before the
final appearance.