git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] string_list API: document what "sorted" means.
Date: Tue, 18 Sep 2012 10:21:46 -0700	[thread overview]
Message-ID: <7va9wnnt5h.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <5058371C.8060209@alum.mit.edu> (Michael Haggerty's message of "Tue, 18 Sep 2012 10:55:56 +0200")

Michael Haggerty <mhagger@alum.mit.edu> writes:

> If another sort order is needed, then we will either have to audit
> existing string_list users to make sure that they don't rely on strcmp()
> ordering, or we will have to implement strcmp() ordering *plus* the new
> ordering.

What I was envisioning was to pass in an optional custom comparison
when you instantiate a string_list object.  Existing callers that
rely on (or can live with, because they do not care about the exact
order) the default order will continue to use the byte-value ordering,
so there is no need for auditing.  Only the new callers that want
different ordering would set custom comparison routine.

But now I wrote it down, I realize that there is no _harm_ in
documenting "we sort in byte-value order, so expect iterations on
sorted string list to give them in that order to you" at all.

So let's go with your documentation patch as-is.

> It's not that I'm unwilling to implement 2; it's just that I still don't
> see any advantage to doing so before there is a demonstrated need for it.

As I said, I have this suspicion that the lack of demonstrated need
is largely because the existing code that do _not_ use string-list
don't do so because the interface is limited, so the argument is
sort of self-fulfilling.

  reply	other threads:[~2012-09-18 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 15:21 [PATCH] string_list API: document what "sorted" means Michael Haggerty
2012-09-17 21:17 ` Junio C Hamano
2012-09-18  7:58   ` Michael Haggerty
2012-09-18  8:19     ` Junio C Hamano
2012-09-18  8:55       ` Michael Haggerty
2012-09-18 17:21         ` Junio C Hamano [this message]
2012-09-19  7:35           ` Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7va9wnnt5h.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).