emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: String interpolation


From: Stefan Monnier
Subject: Re: RFC: String interpolation
Date: Mon, 12 Dec 2016 08:03:41 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> (let ((thing-formatted (replace-regexp-in-string " +" " " thing)))
>   (fmt "This is %{thing-formatted}.2f"))
>
> That is, you're forced to both name and introduce a new temporary
> variable, and you have to alter the format statement itself.  (This is
> what PHP programmers do all the time, and it kinda sucks.)

I see no need for renaming and altering the format statement itself:

    (let ((thing (replace-regexp-in-string " +" " " thing)))
      (fmt "This is %{thing}.2f"))

>   (fmt "This is %{thing}.2f"
>        :thing (replace-regexp-in-string " +" " " thing))
>
> This sucks slightly less, in my opinion.

I still don't see much difference.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]