From: Junio C Hamano <gits...@pobox.com>
> 
> 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()".

So I agree that it is a good name. 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.

Thanks,
Christian.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to