From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: format use inquiry Date: Fri, 30 Jun 2017 19:32:29 -0700 (PDT) Message-ID: References: <7e7f068e4e.fsf@fencepost.gnu.org> <2FDCF579-44BC-49AD-985F-14AE5C654645@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1498876369 13970 195.159.176.226 (1 Jul 2017 02:32:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Jul 2017 02:32:49 +0000 (UTC) To: Jean-Christophe Helary , Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 01 04:32:42 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dR8DB-0003EY-Uc for ged-emacs-devel@m.gmane.org; Sat, 01 Jul 2017 04:32:42 +0200 Original-Received: from localhost ([::1]:46629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dR8DG-0004RR-A9 for ged-emacs-devel@m.gmane.org; Fri, 30 Jun 2017 22:32:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dR8DA-0004RB-1B for emacs-devel@gnu.org; Fri, 30 Jun 2017 22:32:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dR8D6-0007JU-RA for emacs-devel@gnu.org; Fri, 30 Jun 2017 22:32:39 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:28321) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dR8D6-0007JA-Gf for emacs-devel@gnu.org; Fri, 30 Jun 2017 22:32:36 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v612WVAJ022749 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 1 Jul 2017 02:32:32 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v612WVM3006110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 1 Jul 2017 02:32:31 GMT Original-Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v612WV5C010913; Sat, 1 Jul 2017 02:32:31 GMT In-Reply-To: <2FDCF579-44BC-49AD-985F-14AE5C654645@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6770.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216068 Archived-At: > 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 oth= er > source packages and for ex auth-source-pass-tests.el explicitly spells ou= t > all the urls without resorting to smart formatting to save a few characte= rs. >=20 > Also, considering the way %s is abused in other places package.el, for ex > in: >=20 > (message "%d package%s marked for upgrading." > (length upgrades) > (if (=3D (length upgrades) 1) "" "s"))))) >=20 > 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 thou= gh > http/https is not related to l10n). >=20 > 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 f= or > 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).