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: Mon, 17 Sep 2012 14:17:09 -0700 [thread overview]
Message-ID: <7vy5k8s622.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1347895267-5054-1-git-send-email-mhagger@alum.mit.edu> (Michael Haggerty's message of "Mon, 17 Sep 2012 17:21:07 +0200")
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Junio pointed out that the sort order currently used by string_list
> could be considered to be an implementation detail internal to
> string_list. But the sort order is already visible to the outside
> world (e.g., via iteration or via print_string_list()), so it
> shouldn't be changed willy-nilly. Therefore, document the current
> sort order as part of the API's contract.
>
> (If, at some future time, somebody wants a string_list that is sorted
> by a different criterion, then the order should be made specifiable
> via a callback function specified by the user.)
As I said in a separate message, we do not give any documented
guarantee on the order the strings comes out of print_string_list(),
other than "if you are using the unsorted list function to insert or
append strings, we won't muck with the order of the items and you
will get your strings back in the order you gave us". Until we add
a callback that the user can specify at the time of string list
initialization, I do not think it is wise to cast it in stone and
declare it as "shouldn't be changed willy-nilly", unnecessarily
painting us into a corner that we need to expend extra effort to get
out of.
Besides, nobody calls print_string_list() in the first place. I have
always considered it as a debugging aid.
next prev parent reply other threads:[~2012-09-17 21:17 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 [this message]
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
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=7vy5k8s622.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).