[swift-evolution] Thoughts on replacing \() with $() or some other symbol

Jeremy Pereira jeremy.j.pereira at googlemail.com
Wed Jun 22 10:55:04 CDT 2016

> On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution <swift-evolution at swift.org> wrote:
> Sorry, but can you explain why the character used to   escape   strings is also the best choice to do   Variable value extraction/String interpolation?  They are two different concepts.

No they are not.

Escape means nothing more than “stop interpreting characters literally for a bit and do something else”. It’s perfectly reasonable to think of \( … ) as a nothing more than a complicated escape sequence. I don’t think anybody has ever been confused by the fact that it happens at run time rather than compile time.

Furthermore, if you change the escape character you have to introduce another escape sequence fro the character you have just taken and “$", I would argue is a poor choice since it is probably reasonable common to find it used literally in strings (unlike “\").

More information about the swift-evolution mailing list