U+ 1.0.0
[u-plus] / README.md
1 # U+: pretty Unicode code point literals
2
3 I was reading <https://uncyclopedia.com/wiki/Rust_(programming_language)>
4 for some reason, and read `let U = 0; U = U + 1;`.
5
6 Suddenly my mind was awhirl with a Concept. I implemented it at once.
7
8 ## The problem
9
10 Unicode expresses its code points in syntax like U+1234 (full range U+0000–U+10FFFF).
11
12 But then when you want to transfer it to a programming language,
13 you have to learn another syntax. Will it be `\u1234`, `\u{1234}`,
14 `\x1E\x88\xB4`, `\341\210\264`, something else?
15
16 And then astral plane characters make it even worse:
17 `\U0001F631`, `\u{1F631}`, `\xF0\x9F\x98\xB1`, `\uD83D\uDE31`
18 (with all the associated pain the abomination UTF-16 entails,
19 especially that your char type may simply not be able to represent this),
20 something else?
21
22 And so here is this crate that lets you use the True Unicode Syntax:
23
24 ```rust
25 use u_plus::U;
26
27 assert_eq!(U+1234, '\u{1234}');
28 ```
29
30 So forget about `\u{…}` syntax!
31
32 (Caution: there are some limitations with this approach, see KNOWN_ISSUES.md for details.)
33
34 > “All things are lawful for me,” but not all things are profitable.
35 > “All things are lawful for me,” but not all things build up.
36 >
37 > — Paul the Apostle, *1 Corinthians 10:23*