From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: RFC: String interpolation Date: Thu, 8 Dec 2016 14:31:22 -0500 Message-ID: <9f4dbc5a-7978-8cdb-d8f5-05d853ff4a99@gmail.com> References: <51825111-ace4-f750-4077-026a3b648d27@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rlnRLHX0vknpMrhUdo9tc2kQdvaV1KNI9" X-Trace: blaine.gmane.org 1481225605 14264 195.159.176.226 (8 Dec 2016 19:33:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2016 19:33:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 08 20:33:22 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 1cF4RT-0002Mk-7e for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 20:33:19 +0100 Original-Received: from localhost ([::1]:48431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF4RX-0003NR-C9 for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 14:33:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF4Pl-0002fL-A9 for emacs-devel@gnu.org; Thu, 08 Dec 2016 14:31:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cF4Pi-00081e-7z for emacs-devel@gnu.org; Thu, 08 Dec 2016 14:31:33 -0500 Original-Received: from mout.kundenserver.de ([212.227.17.10]:51319) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cF4Ph-00080o-SH for emacs-devel@gnu.org; Thu, 08 Dec 2016 14:31:30 -0500 Original-Received: from [18.26.2.123] ([18.26.2.123]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.184]) with ESMTPSA (Nemesis) id 0MPXwP-1cJB1C2eZ7-004grv for ; Thu, 08 Dec 2016 20:31:27 +0100 In-Reply-To: X-Provags-ID: V03:K0:6PWSQ5+LIbRALY0C0LAToCFKbw3UCRIQfln0SSZ21X+zAmvt9Nu iPvrzeQrnlvxDYeTkUM88jG0Iq8U1+9sAXC2LowaL+f7e8LQ79WsngOKLR9oeaGJaVvGlX3 R1tcRcICEd5K+Wo5lnTVC8YUnaZjpzU+U5/OwaBkfRkE/W3NndD6DBbxMCRWvekXMrSP3jH 8TXmzvnSggpvfh4mRBdEg== X-UI-Out-Filterresults: notjunk:1;V01:K0:DQMrcbt1ngs=:wRdBYKcc5h3UMIlgFwguK9 oiuXDNCCH9GQLodrHpx9MuIhRz7PCglcwzCY7mnvlbqcPn9iIuRjtEXs3t3zE7ROpo1pMRU1O xJEbn4wQtADSlo8VpCOF/uANnYdmG4OCWpdz6sRfFeioJzt9ZSsEYNzgSpExlnukpbhpX/Z3k 9tJv09H8cejsGkii7FHwvT0Ghej50gbusAI0e8V0xBLkaB9KjiePFVVmuH+k/uMs45+7pVX7K tjIMghbLsugYamP3R6qGB3d4n9dzh+DKjowrt47UOFqTBZncwyLi6G+vJe0Xol1mS4/+Uxj6p CXrkzjJ1uFehTUAhEX6TyNdOsC3DMe9cKw3pSjpFeLnH+S9pvPd9zXxCwomBpoS4sYX2xdajI Kw6R+qe0bWFd6qq0axHHg1gDzpjh7EwcLkVHjY8U1N6WRYQLyFsyHvJ5nV8uzSqXva6HLYdvT KT0s/4mYTnMtIfF2uJLZANuixUnLav7lmQ7vGVqIr+lgkWEyS6W3k4jNG86WNr+OyTcSHwcYS LDxOB6SRZdbIDJfFGCy07tO0n9OlE0uV0jqvWGakoLGf+5tITgX4Vh1HBNA9zbHjWuyEKkmVP iwAn7V6Ovg4Jqz65jxdC89xvGu8xCILUHMtQI+NT2inj1mRl7Fxr4b3L/yGf+n7vO6RvaScIT s1QFr4dAHmes06qOzzus4HKUkUOgj+rQ67Pai7AoK/Ia+tivimHsRx73/GObQDp+2PvU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 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:210148 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rlnRLHX0vknpMrhUdo9tc2kQdvaV1KNI9 Content-Type: multipart/mixed; boundary="BxihVd9d13iCHBSmEka75cbFrsaCSJxLu"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <9f4dbc5a-7978-8cdb-d8f5-05d853ff4a99@gmail.com> Subject: Re: RFC: String interpolation References: <51825111-ace4-f750-4077-026a3b648d27@gmail.com> In-Reply-To: --BxihVd9d13iCHBSmEka75cbFrsaCSJxLu Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2016-12-08 14:05, Stefan Monnier wrote: >> (let ((a 12) (b 15)) >> (fmt "$a + $b =3D $(+ a b)")) >=20 > Looks good. Thanks :) >> (concat (fmt--print a) " + " (fmt--print b) " =3D " (fmt--print (+= a b) 'format "%.2f")) >=20 > I'm surprised, I'd have expected to expand to a call to (format ...). > At least that's what my own take on it did (see below; incidentally it > looks otherwise eerily similar to yours in syntax). Neat, it looks like they do almost exactly the same, right? Except % vs. = $. The nice part about not constructing a top-level call to format is th= at the full format string doesn't need to be reparsed every time. You co= uld even imagine getting rid of format entirely, and parsing even the for= mat sequences at compile time. > FWIW, I don't much like adding extra cases, so I'd stick to a minimal > solution at least until we have enough experience with it to be sure > which extra cases are worth the trouble. Sounds reasonable. I'm happy to drop the extended format codes with "|" = in them. Since ELisp variable names routinely include slashes and colons= , I think having {} is useful (looks like your implementation supported t= hat too?). Being able to specify a format string is nice too. >> * Should this go into MELPA, ELPA, or core? >=20 > I think it might be worth thinking about it in the larger context of ot= her > special formatting we might have in strings. I'm thinking here about > things like docstrings and their \\[...] and stuff. If we could > imagine a path where those could end up merging, it would be great. Indeed! > (defmacro preformat (string) =2E.. This looks good too, thanks! --BxihVd9d13iCHBSmEka75cbFrsaCSJxLu-- --rlnRLHX0vknpMrhUdo9tc2kQdvaV1KNI9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYSbUKAAoJEPqg+cTm90wjM+kP/iSbTiXMpKf1qDuvj80EYpZR ONP+QJnlp1pA6f9MIY88S20JCLXHM7tpFf4p8hmKsAZ5QqHmuzFJ9XpYk6mCa1A+ nuqD4V/+PYVhcFXXcHWhGC6VK5D3RY1EClmK3pCIYrBPY0yUjw5R0v1O9s6j9fud 96ve2J0+d6HDa/2ID1nBjVVPBm1XUGzWOMOytPp5LFt9olK3tV2eeppFHQAJXrGK xUaCi5zOse7hN/JEHZE/noL5i3Hst482T3ZfrYsdmfAjVcY5mJB0bkKdnHp2ZF4S 07+5Lyg2qXoCZ1yfBMYf8PFO/Kth3kz2g5gYsxsd9PcDdBoxdw90VVvmbTGP9kPo wT+6ffi+iiG05S1GFIZwlnFv7WpG+Npd6bCPUpw9Ap4jnOnMPbmyAvAE/Q1URlPp wK0bdjwYJwHd40PALl8QfXAMWbsrJei1NTr9dgAKYkchb4xIv/vC+bJaaFrAC2P8 yBxclejxPx89CnQmXgPvVTpir02+15f8b7FlJiGZ2zZWFIeDQm2punTNSb0VRUx4 ++zMzhlwtZHz3z22t9suxiBwVbObV6UX7s2cEFe1NdMJdsm3PwG+M5bFAKWbesPL kk2ON+vErscSKPYI7K+UCIXoxApfbZZizMmRWaGhNIdb9jBStsXoTX/FqqO9c+Xb dAgVGVIKPhJHo2uTRnJk =Enav -----END PGP SIGNATURE----- --rlnRLHX0vknpMrhUdo9tc2kQdvaV1KNI9--