From: Junio C Hamano Date: Tue, 06 Mar 2012 06:46:20 GMT Subject: Re: [PATCH] i18n: Not add stripped contents for translation Message-ID: <7v399mw7k3.fsf@alter.siamese.dyndns.org> In-Reply-To: Jiang Xin writes: >> This is a tangent and I am just showing aloud my ignorance, but I wonder >> if there is a reasonably generic and "best current practice" way to >> structure code to show an enumeration in human languages, for example, > ... > I write a function for this. It is not a very good API design to use static array in a function like your code. You will often want to walk list of lists in a nested loop and want to have two "appends" running in parallel. Imagine you are merging three branches A, B and C in an octopus merge, and want to say "commits A1 and A2 were merged from A". You would want to structure the caller like this: clear_list(&list_of_branches); # this walks branches A, B and C foreach branch append_item(&list_of_branches, branch); clear_list(&list_of_commits); # this walks commits on the branch foreach commit on branch append_item(&list_of_commits, commit); # this shows e.g. "commits A1 and A2" format_list_as_human_string(&list_of_commits); # this shows e.g. "branches A, B and C" format_list_as_human_string(&list_of_branches); In any case, I was not asking anybody to come up with an original solution. Rather, I was asking if somebody knew an already widely used library-ish implementation we can just reuse. If there is no such thing, we may end up designing one ourselves, but we shouldn't be doing so if we don't have to.