On 2016-12-09 14:19, Ted Zlatanov wrote: > On Wed, 7 Dec 2016 20:13:41 -0500 Clément Pit--Claudel wrote: > I'd rather see either something like Mustache templates or simply using > the format-spec.el that comes with Emacs. The advantage in my opinion > (informed by many years of using Perl, where string interpolation is a > way of life) is that clarity is improved by separating the format spec > from the data that fills it out, and it's very tempting to stuff logic > into strings but maintenance is unpleasant. Thanks for the feedback! Can you share concrete examples in which this makes maintenance harder? The approach I outlined is significantly influenced by the direction that Python is taking (see the PEP I linked to in the original message). > (let ((a 12) (b 15)) > (format-spec "%a + %b = %u" (format-spec-make ?a a > ?b b > ?u (+ a b))) Thanks. Are there benefits of this over just (format "%s + %s = %s" a b (+ a b))? The names ?a and ?b seem redundant, and ?u doesn't carry specific meaning. (FWIW, Python has template strings for that purpose, but virtually no one uses them, AFAICT). Also: how does format-spec deal with formatting sequences, like %-3.2d? > I see no advantage to this versus `format-time-string'. It's ambiguous > and the time zone can't be specified without making it more complicated. Yup; it's unfortunate that ELisp's notion of date doesn't come with a timezone. > This one in particular is heading in the direction of the way Ansible > integrates Jinja templates, which I think is not great compared to a > more Lispy approach. I have no strong feelings either way. I like the way Python is going, so it feels natural to suggest the same direction for Emacs. I view it as a convenient DSL for producing strings, just like the loop macro is a good DSL for iterating and accumulating results — and we're a Lisp, so we're good at DSLs :) Clément.