Go2将修改导出规则
chai2010 · · 2885 次点击 · · 开始浏览Go2将修改导出规则, 只有小写字母和"_"开头的不导出.
中文等不区分大小写的标识符默认导出.
A solution that's been kicking around for a while:
For Go 2 (can't do it before then): Change the definition to "lower case letters and _ are package-local; all else is exported". Then with non-cased languages, such as Japanese, we can write 日本語 for an exported name and _日本語 for a local name. This rule has no effect, relative to the Go 1 rule, with cased languages. They behave exactly the same.
http://code.google.com/p/go/issues/detail?id=5763
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
Go2将修改导出规则, 只有小写字母和"_"开头的不导出.
中文等不区分大小写的标识符默认导出.
A solution that's been kicking around for a while:
For Go 2 (can't do it before then): Change the definition to "lower case letters and _ are package-local; all else is exported". Then with non-cased languages, such as Japanese, we can write 日本語 for an exported name and _日本語 for a local name. This rule has no effect, relative to the Go 1 rule, with cased languages. They behave exactly the same.