<p>if i could use UTF-8 in variable names, so how i could export a variable?</p>
<hr/>**评论:**<br/><br/>Bake_Jailey: <pre><p><a href="https://golang.org/ref/spec#Exported_identifiers" rel="nofollow">https://golang.org/ref/spec#Exported_identifiers</a></p>
<p>The spec isn't that hard to read. You'll get a lot out of it.</p></pre>mrwnmonm: <pre><p>i'm not used to read the spec, i rely on "effective go" document<br/>
and actually what i was talking about is not mentioned in the spec nor the effective go</p></pre>Redundancy_: <pre><p>I'm not sure I understand:</p>
<blockquote>
<p>the first character of the identifier's name is a Unicode upper case letter (Unicode class "Lu");</p>
</blockquote>
<p>(from the spec)
That set of characters - <a href="http://www.fileformat.info/info/unicode/category/Lu/list.htm" rel="nofollow">http://www.fileformat.info/info/unicode/category/Lu/list.htm</a></p></pre>mrwnmonm: <pre><p>i think i was confused, sorry<br/>
i thought there is a best practice for other languages that is not mentioned</p></pre>throwbible: <pre><p>Kinda sucks for languages that uses unicameral casing, like Georgian. They won't be able to export identifiers.</p></pre>weberc2: <pre><p>They'll just have to prefix them with unicode upper case letters.</p></pre>TheMerovius: <pre><p>The usual recommendation is to not export identifiers outside of ASCII, because people won't be able to type them anyway, i.e. you just make the usage of your package harder.</p>
<p>If they do feel the need, people usually prefix their public identifier with an X when using a written language without capital letters. It's not elegant, but it works.</p></pre>mrwnmonm: <pre><p>thanks</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传