或者这是一个神话? 在任何官方文档中都看不到它的提及(它在那里,D'oh!)——当我将 Atom 与 go-plus 包一起使用时,它似乎对我不起作用。很遗憾,因为我正在做很多数学运算,而且我喜欢数学符号。
更新:我不认为任何数学符号深奥:‖ ⏋∪ 与任何表情符号相比:😀
引用官方来源的是或否答案就足够了!
更新:感谢 elithrar 的回答,我发现“拉丁字母横向点击”ǁ 是我想要的“双垂直线”的看似完美的类比。
最佳答案
根据 https://golang.org/ref/spec#Identifiers,Go 支持 一些 Unicode 类别
Identifiers name program entities such as variables and types. An identifier is a sequence of one or more letters and digits. The first character in an identifier must be a letter.
identifier = letter { letter | unicode_digit } .
上述类在规范中定义为:
unicode_letter = /* a Unicode code point classified as "Letter" */ . unicode_digit = /* a Unicode code point classified as "Decimal Digit" */ .
In The Unicode Standard 6.3, Section 4.5 "General Category" defines a set of character categories. Go treats those characters in category Lu, Ll, Lt, Lm, or Lo as Unicode letters, and those in category Nd as Unicode digits.
“简短”的答案是支持一些 运算符,具体取决于它们的字符类。更深奥/专业的不会。
关于unicode - Go(golang)是否真的允许在变量名中使用 unicode 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33947871/