Naming in Go for proper nouns that begin with a lower case letter

huangapple go评论101阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2017年9月13日 16:07:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/46192184.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定