From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: RFC: String interpolation Date: Mon, 12 Dec 2016 14:43:28 -0500 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> Reply-To: rms@gnu.org NNTP-Posting-Host: blaine.gmane.org Content-Type: text/plain; charset=Utf-8 X-Trace: blaine.gmane.org 1481571837 21632 195.159.176.226 (12 Dec 2016 19:43:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 19:43:57 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 20:43:52 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 1cGWVr-0004kE-Lf for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 20:43:51 +0100 Original-Received: from localhost ([::1]:33342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGWVv-0008N2-RN for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 14:43:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGWVh-0008Hf-0I for emacs-devel@gnu.org; Mon, 12 Dec 2016 14:43:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGWVg-000493-EP for emacs-devel@gnu.org; Mon, 12 Dec 2016 14:43:41 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGWVV-000450-3Y; Mon, 12 Dec 2016 14:43:29 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1cGWVU-0007Mv-Ge; Mon, 12 Dec 2016 14:43:28 -0500 In-reply-to: (message from Lars Ingebrigtsen on Mon, 12 Dec 2016 10:44:30 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:210369 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > (let ((thing-formatted (replace-regexp-in-string " +" " " thing))) > (fmt "This is %{thing-formatted}.2f")) > That is, you're forced to both name and introduce a new temporary > variable, and you have to alter the format statement itself. (This is > what PHP programmers do all the time, and it kinda sucks.) > With the optional keyword arguments, you just add it: > (fmt "This is %{thing}.2f" > :thing (replace-regexp-in-string " +" " " thing)) If we are going to allow referencing variables, and referencing keyword arguments, we should distinguish them in the syntax. Perhaps write a colon to reference a keyword argument, like this: > (fmt "This is %{:thing}.2f" > :thing (replace-regexp-in-string " +" " " thing)) Another syntactical issue is that '%{thing}.2f' has a problem: Does it mean %{thing} formatted according to '.2f', or %{thing} followed by the text '.2f'? Using the syntax '%[.2f]{thing}' is superior because it avoids any syntactic ambiguity. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html.