From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Lars Ingebrigtsen <larsi@gnus.org>
Newsgroups: gmane.emacs.devel
Subject: Re: RFC: String interpolation
Date: Mon, 12 Dec 2016 18:12:36 +0100
Message-ID: <m3twa99im3.fsf@gnus.org>
References: <51825111-ace4-f750-4077-026a3b648d27@gmail.com>
	<8737hwnc52.fsf@lifelogs.com> <m34m2bj2m2.fsf@gnus.org>
	<8c117f5c-209a-97d8-79ce-a78f707f0545@gmail.com>
	<m3wpf7hjzf.fsf@gnus.org>
	<76c9c475-0180-aa49-3d4a-006d4e3f943c@gmail.com>
	<m3oa0ifgvd.fsf@gnus.org> <m2k2b6rxaj.fsf@gmail.com>
	<m38trmdun6.fsf@gnus.org>
	<jwvr35dub31.fsf-monnier+gmane.emacs.devel@gnu.org>
	<m3r35dcwht.fsf@gnus.org> <jwva8c1ti95.fsf-monnier+emacs@gnu.org>
	<m37f755hnc.fsf@gnus.org> <jwv4m29tcni.fsf-monnier+emacs@gnu.org>
	<m337ht5fub.fsf@gnus.org>
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 <monnier@iro.umontreal.ca>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 18:16:00 2016
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	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 <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	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 <larsi@gnus.org>) 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 <larsi@gnus.org>) 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 <larsi@gnus.org>) 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 <larsi@gnus.org>)
	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: <m337ht5fub.fsf@gnus.org> (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." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel/>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: "Emacs-devel" <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.devel:210351
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/210351>

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