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 18:12:36 +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 1481562968 4702 195.159.176.226 (12 Dec 2016 17:16:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 17:16:08 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 18:16:00 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 1cGUCb-0007gW-Ob for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 18:15:49 +0100 Original-Received: from localhost ([::1]:59410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGUCf-0006p3-OO for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 12:15:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGU9f-0006d4-Pi for emacs-devel@gnu.org; Mon, 12 Dec 2016 12:12:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGU9b-0002ob-QK for emacs-devel@gnu.org; Mon, 12 Dec 2016 12:12:47 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:49284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGU9b-0002o1-K6 for emacs-devel@gnu.org; Mon, 12 Dec 2016 12:12:43 -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 1cGU9U-0002he-SQ; Mon, 12 Dec 2016 18:12:38 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEVOyPtUyfpNxflv0fZZ k61Ox/tOxvpQwPFXvLhHAAACb0lEQVQ4jW1UTXPaMBDdThFcsUnIOaI4Z2r3TooSriqZVa5GiZSr ARP9/T7J2Ek72WH8sU/v7Up+Cx1lSCGlLAppvezijo63szLLslm5KstylV1CSjqWn2I1PEi6LfNb 7/dZNt/vp4TFNMZrKWnx01qvhdFCUx/Ms5wWuTSFY+Gc4C4tNC+fEmCRZwaWOJrw8j2nU+52kWBY c6cWFyXAGzwZx+4iBQ4nqcLVSPMHgPv3VMM5qh2UtO4B0TE86yjEg5QWXQ2PnMXFDRvpAUThTeGX rFNXOkqdcrv0zvu3MMRDKn6aI13YEKY8qbG+bagZpIwPBxI0WhONVE1nMK4BFPwcmjH6Ha0n1aQi MJJULn3Qftw2YrQdqVfV9MBcFsHTRL3zqzqpVg01EjBuVUCyVcgnRqxhAXikUkzR2Jl1VyMCVak2 qt0iPaGzSRucWx/2bQX9KFPTTrwzp50XPtxUCoSgiKofit8dLy4AKrRqWwLA/fjg7EuUAlC12+xK qfUEjW22j96lGt4ENbrPru7bLdpq2+2j3b0kM3BQszVdrWPLlWqef0uZAENhU639pIlAe3gLuZSp uBcoHjfWbtQjhYORF8Do8G0KzxAauwlnYSNwE9t1Ido1fqO7MHVpQhaXY+/joE03Nx2D++/dGDb2 A7AORoJN4Tg4spu1TsrB5gaGNZycZHugcFoQe/w0G8zE7qN49BnD9BgAY90nRp385zFTDn1/AsAQ gsDQMDpHqcshIg8EM6hx1aJw5umaFnPfDZhIYyDiIWDUAPyi/0N047wa5rtjRsqfckf78qvAX0Y9 +wrIJS3/kdfCxRo7b/8C+Dr13LXWZP0AAAAASUVORK5CYII= In-Reply-To: (Lars Ingebrigtsen's message of "Mon, 12 Dec 2016 16:26:04 +0100") 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:210351 Archived-At: If we take one step back and look at our objectives and options here, this is how I see it: 1) It is somewhat attractive to be able to drop variables into formatting strings: Quite a lot of popular programming languages allow this. 2) It is not that attractive to extend this to general programming constructs, because code inside strings is just ... bad. 4b) But people sometimes need to tweak the look of the values before they are printed, and forcing people to switch between paradigms is also bad. 4d) Introducing new variables, or values visible outside of the formatting statement is bad, because things that belong inside the formatting statement belong inside, not outside (for readability and maintainability). Solution: Allow 1), and provide 4b) by putting the extra code inside the formatting statement, but not inside the string itself. Ergo: (fmt "This is %{thing}s and %{zot}.2f" :thing (replace-regexp-in-string " +" " " thing)) If, however, you don't mind 4d) at all, and think that introducing new bindings is a spiffy way to do programming (shades of the fabulous interface that `url-retrieve' has now), then I guess I can't really say much more than: =C2=AF\_(=E3=83=84)_/=C2=AF --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no