英文:
Naming in Go for proper nouns that begin with a lower case letter
问题
如果一个类型需要是公共/导出的,并且名称代表iPhoneX、iOS、eBay等,你该如何命名它们?
你会将它们命名为IPhoneX和IOS吗?或者如果现实世界中的名称以小写字母开头,你会如何命名这个类型?
英文:
How do you name a type if it should be public/exported and the name should stand for: iPhoneX, iOS, eBay, etc.
Do you name them IPhoneX and IOS? or how do you name a type if the name in real world starts with lowercase letter?
答案1
得分: 2
如果你想要导出名称,那么名称的首字母需要大写。所以我认为你提议的名称在需要这样的情况下是可以的。
英文:
You need to start the name with uppercase letter if you want to have it exported anyway, so I would say that your proposed names would be fine for cases in which you need such names.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论