unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>,
	Emacs development discussions <emacs-devel@gnu.org>
Subject: RE: format use inquiry
Date: Fri, 30 Jun 2017 19:32:29 -0700 (PDT)	[thread overview]
Message-ID: <fd204570-69c0-4edd-919b-71cafe067c84@default> (raw)
In-Reply-To: <2FDCF579-44BC-49AD-985F-14AE5C654645@gmail.com>

> Paul suggested that it would be a maintenance hassle to keep 2 almost
> identical urls if we spelled them out as Yuri suggested but I checked other
> source packages and for ex auth-source-pass-tests.el explicitly spells out
> all the urls without resorting to smart formatting to save a few characters.
> 
> Also, considering the way %s is abused in other places package.el, for ex
> in:
> 
>  (message "%d package%s marked for upgrading."
>         (length upgrades)
>         (if (= (length upgrades) 1) "" "s")))))
> 
> I don't think it is good to keep the above code because it gives bad
> incentives to authors especially if work on i18n/l10n proceeds (even though
> http/https is not related to l10n).
> 
> So, I'm going to spell out the urls as I proceed with untangling code and
> translatable strings in package.el. I'll send a diff here when I'm done for
> evaluation.

FWIW, I think this is a bit misguided.  It seems to
be putting translation/localization interests before
code-readability - IOW, making things simpler for some
tools or secondary uses of code, rather than keeping
them simple for someone to read.

I'm not arguing maintenance burden but readability
(which also affects maintenance burden).

Maybe some sacrifice of code simplicity is needed in
the interest of translation-help.  But I think another
approach should be sought than what you've proposed.

Code, especially Lisp code, is partly about expressing
something symbolically, to yourself and others who read
the code.

If you factor out the part of two things that is common,
that makes it easy to _see_ what is common and what is
different.

If you instead use two URLs that are almost identical
then you make a human reader scan each of them looking
for differences:

(if (gnutls-available-p)
    "https://elpa.gnu.org/packeges/";
  "http://elpa.gnu.org/packages/";)

(Did you spot the typo?)

Here the URLs are pretty short, so you might not
get a headache immediately, scanning and comparing.
But imagine the mental load if they were a lot longer.
Or if you had to scan and compare lots of them.
Spend an evening doing that and you might change your
mind about how great it is to duplicate all of that
common text.

You could bind a variable to name each one:

(let ((https "https://elpa.gnu.org/packages/")
      (http   "http://elpa.gnu.org/packages/"))
  (if (gnutls-available-p) https http))

(You can come up with better var names.)

That still makes someone scan and compare, but
it at least points out (names) what the expected
difference is.  I don't claim it doesn't suffer
from what I complain about above, but it seems a
bit less burdensome to me.

There might be other approaches.  None of this
matters much if we're talking only about someone's
preferred style here or there.  But if we're
talking about a wholesale change then maybe some
better approach can be found.

Just one opinion.

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).



  reply	other threads:[~2017-07-01  2:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  8:48 format use inquiry Jean-Christophe Helary
2017-06-20 11:20 ` Thien-Thi Nguyen
2017-06-20 15:02 ` Yuri Khan
2017-06-20 19:51   ` Jean-Christophe Helary
2017-06-20 22:53 ` Glenn Morris
2017-06-21  0:20   ` Jean-Christophe Helary
2017-06-21  1:23     ` Paul Eggert
2017-06-21  3:38       ` Jean-Christophe Helary
2017-06-22  1:57   ` Richard Stallman
2017-07-01  1:56     ` Jean-Christophe Helary
2017-07-01  2:32       ` Drew Adams [this message]
2017-07-01  4:38         ` Jean-Christophe Helary
2017-07-01 15:43           ` Drew Adams
2017-07-02  1:35             ` Jean-Christophe Helary

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=fd204570-69c0-4edd-919b-71cafe067c84@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=jean.christophe.helary@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).