From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: RFC: String interpolation Date: Mon, 12 Dec 2016 14:51:09 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87fultkjte.fsf@lifelogs.com> 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> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1481572291 31336 195.159.176.226 (12 Dec 2016 19:51:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 19:51:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 20:51:26 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 1cGWdC-0006qL-GX for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 20:51:26 +0100 Original-Received: from localhost ([::1]:33381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGWdG-0002Bs-JB for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 14:51:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGWdA-0002AT-8l for emacs-devel@gnu.org; Mon, 12 Dec 2016 14:51:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGWd7-0006U5-B6 for emacs-devel@gnu.org; Mon, 12 Dec 2016 14:51:24 -0500 Original-Received: from [195.159.176.226] (port=58688 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGWd7-0006Ts-4P for emacs-devel@gnu.org; Mon, 12 Dec 2016 14:51:21 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cGWd1-0005NT-3H for emacs-devel@gnu.org; Mon, 12 Dec 2016 20:51:15 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 21 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Cancel-Lock: sha1:9U+ELk97HxnfsxHhnD8P7WmP+sc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:210370 Archived-At: On Mon, 12 Dec 2016 09:46:05 -0800 Paul Eggert wrote: PE> Why not just extend "format" so that it allows trailing "...%" in the format PE> string to mean "argument value spliced here"? After the argument you can PE> continue on with the format, which must start with the rest of the conversion PE> specification. E.g.: PE> (format "Altitude= %" alt ".2f, direction = %" dir ".2f.") PE> might output "Altitude = 300.57, direction = 240.93." I like how this separates expressions from strings. It might be more readable if the % begins the next string: (format "Altitude= " alt "%.2f, direction = " dir "%.2f.") It has some downsides: it only works in one function; `(apply 'format ...)` can become surprising; and repeating a parameter requires duplicating the code. Ted