[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: format use inquiry
Re: format use inquiry
Sat, 1 Jul 2017 13:38:50 +0900
> On Jul 1, 2017, at 11:32, Drew Adams <address@hidden> wrote:
> But if we're
> talking about a wholesale change then maybe some
> better approach can be found.
I am certainly not talking about a *wholesale change* but about *1* instance in
the emacs sources that uses that pattern.
Also, I don't think that *code* is especially bad, but considering what I have
seen in the rest of the package.el code, this looks more like a way of thinking
about natural language strings from the authors than about some kind of natural
Btw, I like your:
(let ((https "https://elpa.gnu.org/packages/")
(if (gnutls-available-p) https http))
That's something like that that I had in mind.
I am not conflating l10n and anything else btw. But it happens that authors who
tangle code and strings in general do that all the time without considering
whether the strings they create are internal or external strings. That leads to
real problems: my first interest in package.el came from a number of singular
cases that were not handled, then I checked the code and I found the external
strings had *lots* of problems (and lots of "rationalizations" to save a few
lines that ended up creating strings *totally* unlocalizable).
> Just one opinion.
And mine was equally just one opinion, based on greping about a 100 other .el
files to find similar patterns, where I found that (seemingly) robust code
would prefer redundancy to smarty formatting.
You may want to compare the tons of redundant urls in auth-source-pass-tests.el
to that one instance where using format saved the code a few characters (and
I'm really not sure it adds much in terms of readability).
> As for the question of messages that use singular
> vs plural forms, I'd again point to Common Lisp's
> `format', which addresses that kind of thing (at
> least for English).
Again ? Sorry if I missed the other references.
That -P flag for CL format contributes to producing just as ugly code as what
we have here. Code should never be used to create natural language strings with
Here is the example given in "Common Lisp the Language, 2nd Edition"
(format nil "~D tr~:@P/~D win~:P" 7 1) => "7 tries/1 win"
(format nil "~D tr~:@P/~D win~:P" 1 0) => "1 try/0 wins"
(format nil "~D tr~:@P/~D win~:P" 1 3) => "1 try/3 wins"
How do you think that kind of strings can possibly be localized ?
- Re: format use inquiry,
Jean-Christophe Helary <=