Skip to content

Commit b310c87

Browse files
committed
ES6-style escaping: add drawback: overriding {} with format!
1 parent 387ed90 commit b310c87

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

text/0000-es6-unicode-escapes.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ The behavior would otherwise be identical.
4646

4747
# Drawbacks
4848

49-
This is a breaking change and updating code for it manually is annoying.
50-
It is however very mechanical, and we could provide scripts to automate it.
49+
* This is a breaking change and updating code for it manually is annoying.
50+
It is however very mechanical, and we could provide scripts to automate it.
51+
* Formatting templates already use curly braces.
52+
Having multiple curly braces pairs in the same strings that have a very
53+
different meaning can be surprising:
54+
`format!("\u{e8}_{e8}", e8 = "é")` would be `"è_é"`.
55+
However, there is a precedent of overriding characters:
56+
`\` can start an escape sequence both in the Rust lexer for strings
57+
and in regular expressions.
5158

5259

5360
# Alternatives

0 commit comments

Comments
 (0)