From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: RFC: String interpolation Date: Mon, 12 Dec 2016 19:33:25 +0100 Message-ID: References: <51825111-ace4-f750-4077-026a3b648d27@gmail.com> <8737hwnc52.fsf@lifelogs.com> <8c117f5c-209a-97d8-79ce-a78f707f0545@gmail.com> <76c9c475-0180-aa49-3d4a-006d4e3f943c@gmail.com> <89a6a20d-e135-caad-6b31-760ab7ac90fc@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1481568403 5379 195.159.176.226 (12 Dec 2016 18:46:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 18:46:43 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 19:46:38 2016 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 1cGVcS-0000G0-VC for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 19:46:37 +0100 Original-Received: from localhost ([::1]:33027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGVcX-00086J-8F for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 13:46:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGVPt-0005Rr-UQ for emacs-devel@gnu.org; Mon, 12 Dec 2016 13:33:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGVPp-0008Po-6B for emacs-devel@gnu.org; Mon, 12 Dec 2016 13:33:38 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:50847) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGVPo-0008PF-W1 for emacs-devel@gnu.org; Mon, 12 Dec 2016 13:33:33 -0500 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cGVPh-0000nq-8w; Mon, 12 Dec 2016 19:33:27 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEWxKhXtbSjmVh38qU/8 tVXzhjf9xVf4mkXk+LsdAAACVUlEQVQ4jVWTUXLdIAxFHa8geIbpb8wWoGYBEPob5w1lAWbob16w q+33CuPXhD/r+EpXQgxE2hJRTaHgWK2NWUrxftAV4IjphnDIlCoZow0AVY34Gn+XkomiPGQ6jrgA 6CMiHqHf9teYEtRU/5aBrJUyEiFTfqWY4pEi0gHQIQTRwqWLq7vW1eMjA9yfkm7xjCIVtrzxgRWf Y1qaU9IxMTAenwyebiWUP/AQJeruzvpL8WOz5SfHZSVdjQPIJyibjUJIkVAE5V3Ip0IaigBCxKPW irF4gMSAaBWTmrkf0uyLi9v7iD+FUBMAuqYOkv0chVjVPCk1CwAomisGSgnVDqpICFxLRfehxV4a WBMS6cDgYIBEDFAlaWdybsU/AcQJlJDJMUCNaj+GUfWD6gSFZ8CKUc0XkYnbu1INAF02C5j1Jpyu QF6GcWB3czIlu3B2PlwHInnDBNt9HPTxiA9N4F0Hb/8F87oHv7l+gw+ANqIp2uvKID2AmpTYfThN fUmFsczRZJOdMdxH7KANBKV1dropeqretskhbxQCliHGtyuOQfGGOBQKHuD5imO0RjuNRTQhNEWf 0hpv+gTeI9X6PHbBijXHjYds+OGs4iuw2gJA4QfRQdu3xNuOB4h9+AawcC2VR67vighbKJz9kjuY cTiedrQd4Gt7KGYWIBU7Qh9cY2rxDiryY01CvsA043mwYmGvJ7jWFhK45UQeCzHwu+BFn9gu1Yoh YnszALK/X30QVto47XxmV0q+Y+HENOEJJtptxRzLNiCFxLNhC+i8zQRLWn79A7BrEPawpUdWAAAA AElFTkSuQmCC In-Reply-To: <89a6a20d-e135-caad-6b31-760ab7ac90fc@cs.ucla.edu> (Paul Eggert's message of "Mon, 12 Dec 2016 09:46:05 -0800") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.91.224.195 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:210367 Archived-At: Paul Eggert writes: > Why not just extend "format" so that it allows trailing "...%" in the > format string to mean "argument value spliced here"? After the > argument you can continue on with the format, which must start with > the rest of the conversion specification. E.g.: > > (format "Altitude= %" alt ".2f, direction = %" dir ".2f.") > > might output "Altitude = 300.57, direction = 240.93." > > That way, you can easily replace the expressions without giving them names: > > (format "Altitude= %" (+ alt 100) ".2f, direction = %" (- dir) ".2f.") Hm, that's a solution I don't think I've seen in any other languages? I think this looks kinda attractive... The readability is somewhat hindered by all the quote marks, but if you format it differently (format "Altitude= %" (+ alt 100) ".2f, direction = %" (- dir) ".2f.") it's perhaps clearer. But the "%" on one line and the ".2f" on the next is perhaps not optimal? Hm... What about something like... er... (format "Altitude= %.2f%" (+ alt 100) ", direction = %.2f%" (- dir) ".") Does that look clearer? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no