[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: String interpolation
From: |
Richard Stallman |
Subject: |
Re: RFC: String interpolation |
Date: |
Mon, 12 Dec 2016 14:43:28 -0500 |
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> (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.)
> With the optional keyword arguments, you just add it:
> (fmt "This is %{thing}.2f"
> :thing (replace-regexp-in-string " +" " " thing))
If we are going to allow referencing variables, and referencing
keyword arguments, we should distinguish them in the syntax.
Perhaps write a colon to reference a keyword argument,
like this:
> (fmt "This is %{:thing}.2f"
> :thing (replace-regexp-in-string " +" " " thing))
Another syntactical issue is that '%{thing}.2f' has a problem:
Does it mean %{thing} formatted according to '.2f', or
%{thing} followed by the text '.2f'?
Using the syntax '%[.2f]{thing}' is superior because it avoids
any syntactic ambiguity.
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
- RE: RFC: String interpolation, (continued)
- Re: RFC: String interpolation, Lars Brinkhoff, 2016/12/14
- Re: RFC: String interpolation, Lars Brinkhoff, 2016/12/14
- RE: RFC: String interpolation, Drew Adams, 2016/12/13
- Re: RFC: String interpolation, Clément Pit--Claudel, 2016/12/13
- Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/14
- Re: RFC: String interpolation, Richard Stallman, 2016/12/14
- Re: RFC: String interpolation,
Richard Stallman <=
- Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/12
- Re: RFC: String interpolation, Richard Stallman, 2016/12/13
- Re: RFC: String interpolation, Lars Ingebrigtsen, 2016/12/13
- Re: RFC: String interpolation, Richard Stallman, 2016/12/14
- Re: RFC: String interpolation, Ted Zlatanov, 2016/12/12
- Re: RFC: String interpolation, Helmut Eller, 2016/12/12