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: Sun, 11 Dec 2016 19:41:26 +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> 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 1481481725 28210 195.159.176.226 (11 Dec 2016 18:42:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 11 Dec 2016 18:42:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 11 19:42:01 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 1cG94T-0006YI-0O for ged-emacs-devel@m.gmane.org; Sun, 11 Dec 2016 19:42:01 +0100 Original-Received: from localhost ([::1]:56776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cG94X-0002bU-26 for ged-emacs-devel@m.gmane.org; Sun, 11 Dec 2016 13:42:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cG94Q-0002bD-Et for emacs-devel@gnu.org; Sun, 11 Dec 2016 13:41:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cG94N-0006Jl-Cp for emacs-devel@gnu.org; Sun, 11 Dec 2016 13:41:58 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:57166) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cG94N-0006H3-6g for emacs-devel@gnu.org; Sun, 11 Dec 2016 13:41:55 -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 1cG94A-0000rG-QF; Sun, 11 Dec 2016 19:41:44 +0100 In-Reply-To: <76c9c475-0180-aa49-3d4a-006d4e3f943c@gmail.com> (=?utf-8?Q?=22Cl=C3=A9ment?= Pit--Claudel"'s message of "Sat, 10 Dec 2016 10:49:59 -0500") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEViMj5/T0TRsoqvfFRK FCL7/Pru5tYKTK/7AAACQUlEQVQ4jU2SwXLrIAxFRcJ0jUKn6waPvTamzZrO8xfkjVjX9sD/f0Il cJzICxsd6QrDBeo89LSoIZeSU7rqnj7VlAloDeaNaOFvie6NVrADMUidj0NJ/KzTQJnSIg0MuOVd cWoFY2Ei2sDeqAJu0apPIS/9du7pS4W+AZlyykum8YOuNxptyDtIHZaicoITLRda7EQHsMP1PG1o nT/l/3g7QPhYx/O/u3OrMn3C6ZAK3w7gzMvNwAf5J/D9BiAKIfCc6+UB7j4vUeHEFV6AfYKygK0A 4ZRfAf2CdNw9xhN9PsGYFlA+DJu38VReQVkBPIaAPLyMz+Ffl8TbRY4R3go8wfhTRvjxiBZgWH5e /iPeFpgNGoiQf1U7K6EdjwSYQUc43Q0OFRQm3bsaFklHPn6wfQWDgC+4lE8G83eqThDguHHzYG6b iTr2K7QRDIoc7zuo4OyVL4Qtkg/A3tIAzlxMhHYblKqU+GEGgDhHDHVPKbUO8cMsoayTBnYZA9kw E9SgMUwtnwtMD9IFDteMyq5k4Cqg4jhanv3tIAihtm4vri+rA8tk2MkeXO8C8PU8xI6G1YUKwiFW Y3WuE2ArGfKhswNVSZgGlkucZv1uB4iVsF6peSdLD9HMjbDe6iZ+QgPzrDV32SCKVVXSiNDOToC3 iG1gwAeIu9pezw2mgZkvCK3lFoNYnfcE8kM8yxhUBpTRDxDrvtlzRim+SzbZASSvgLNcrQ8w61kZ KWUdo3l1gFk+ZZLogNavQBjnuElc/AdTuPi2Cs6feQAAAABJRU5ErkJggg== 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:210297 Archived-At: Cl=C3=A9ment Pit--Claudel writes: >> (with-format ((zot "foo") >> (thing (funcall '+ 3.42423 4))) >> "This is %{thing}.2f and %{zot}ss") > > This looks fine too, but the repetition bothers me (I don't really see wh= at benefit there is to naming all arguments). So I still find > > "This is %(funcall '+ 3.42423 4).2f and "foo"s" > > more readable. Yeah, the repetition isn't nice, but it's all a choice of how explicit and how little magic you want to have. In the `with-format' you're taking things explicitly out of the lexical/dynamic space the values may live in an put it into the lexical form. The other approach I mentioned is less explicit: (fmt "This is %{thing}.2f and %{zot}ss" (thing (funcall '+ 3.42423 4))) If the named parameter mentioned isn't part of the value alist, then it's taken as a variable in its lexical/dynamic space, but if it does, then we use the value provided in the alist. Lisp has traditionally erred on the side of explicitness, but there's a movement towards more magic these days. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no