4 ms·
Just for fun, here's Go handling a char outside the BMP (😃, U+1F603): http://play.golang.org/p/qg7POYAAOL http://play.golang.org/p/qg7POYAAOL
by twotwotwo 13y ago
Just for fun, here's Go handling a char outside the BMP (😃, U+1F603):
http://play.golang.org/p/qg7POYAAOL http://play.golang.org/p/qg7POYAAOL
- samatman 13y agohttps://github.com/mnemnion/emojure/ https://github.com/mnemnion/emojure/ You can even export them without Capital letters ;-)
- twotwotwo 13y agoI did run into at least one eminently reasonable use of how Go source is defined to be in UTF-8. Comments in the crypto libs just use math symbols where they're handy, like this in crypto/rsa[1]: // Check that de ≡ 1 mod p-1, for each prime. // This implies that e is coprime to each p-1 as e has a multiplicative // inverse. Therefore e is coprime to lcm(p-1,q-1,r-1,...) = // exponent(ℤ/nℤ). It also implies that a^de ≡ a mod p as a^(p-1) ≡ 1 // mod p. Thus a^de ≡ a mod n for all a coprime to n, as required. Sadly, the spec requires identifiers to be just Unicode letters and digits, so we will never experience the power and glory of emoji function names in Go. [1] http://golang.org/src/pkg/crypto/rsa/rsa.go http://golang.org/src/pkg/crypto/rsa/rsa.go