emacs-devel
[Top][All Lists]
Advanced

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

Re: RFC: String interpolation


From: Paul Eggert
Subject: Re: RFC: String interpolation
Date: Mon, 12 Dec 2016 09:46:05 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Why not just extend "format" so that it allows trailing "...%" in the format string to mean "argument value spliced here"? After the argument you can continue on with the format, which must start with the rest of the conversion specification. E.g.:

  (format "Altitude= %" alt ".2f, direction = %" dir ".2f.")

might output "Altitude = 300.57, direction = 240.93."

That way, you can easily replace the expressions without giving them names:

  (format "Altitude= %" (+ alt 100) ".2f, direction = %" (- dir) ".2f.")

This should provide the desired benefits without having to do anything fancy with variable scoping or changing the lexer or whatever.




reply via email to

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