Closed emlyn closed 8 years ago
I agree with you, I'm also not very happy with the current naming, but I don't know a better one. The ~
seems a good candidate to be an alias. Any other ideas?
I also quite like $
, if the escape character is also changed to match, like: ($ "Value = ${value}")
. In fact, I think it's much more intuitive than ~
inside the string.
~
is a character used in clojure as syntax-unquote reader macro, and is very familiar, this is because is used and I like the current approach. In other hand use ~
as function/macro name is not convincing me... I don't know a better alternative right now...
Ah that makes sense, I should have noticed :-) Here are a few ideas for the macro name, I'm not completely convinced by any of them, but might be a starting point for discussion:
terp
(inTERPolate)serp
(for "string interpolation", similar to LERP which is the accepted abbreviation of Linear Interpolation)istr
(for "interpolated string")str~
(combine str
with interpolation char)I have choiced istr
;) thanks
I'm really liking the new string interpolation macro. However, while I understand the name (
<<
) is meant to be inspired by bash's heredoc syntax, I find it a bit unintuitive (making me think instead of C++ streaming / bit shifting operators, or some variation of Clojure's threading macros).I thought that maybe
~
would be a better name, given that it is also the character used to start an interpolation inside the string. Also, it is not really used much as an operator in other languages, so might be less confusing.Or maybe a completely different character could be used as both the name and the escape character to start interpolation (e.g.
$
?).What do you think?