[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: String interpolation
From: |
Clément Pit--Claudel |
Subject: |
Re: RFC: String interpolation |
Date: |
Sat, 10 Dec 2016 10:49:59 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 2016-12-10 10:39, Lars Ingebrigtsen wrote:
> As Ted alluded to, there's a different, template based method that I
> think is more promising and is growing more popular in newer languages.
I don't know: Python has had it for a while, no one uses it, and they are now
introducing interpolation…
> (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 what
benefit there is to naming all arguments). So I still find
"This is %(funcall '+ 3.42423 4).2f and "foo"s"
more readable.
But in any case, what you're suggesting is just a limited form of
interpolation, right? IIUC it's actually already offered in s.el. With the fmt
that I suggested, you'd write this:
(let ((zot "foo")
(thing (funcall '+ 3.42423 4)))
(fmt "This is $[%.2s]{thing} and ${zot}s"))
Or would with-format behave differently?
signature.asc
Description: OpenPGP digital signature
Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/10
- Re: RFC: String interpolation, Clément Pit--Claudel, 2016/12/10
- Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/10
- Re: RFC: String interpolation,
Clément Pit--Claudel <=
- Re: RFC: String interpolation, Yuri Khan, 2016/12/10
- Re: RFC: String interpolation, Clément Pit--Claudel, 2016/12/10
- Re: RFC: String interpolation, Stefan Monnier, 2016/12/11
- Re: RFC: String interpolation, Yuri Khan, 2016/12/11
- Re: RFC: String interpolation, Stefan Monnier, 2016/12/11
Re: RFC: String interpolation, Richard Stallman, 2016/12/11
Re: RFC: String interpolation, Clément Pit--Claudel, 2016/12/11
Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/11
Re: RFC: String interpolation, Richard Stallman, 2016/12/12
Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/11