问题描述
我个人不喜欢编程语言区分大小写。
I personally do not like programming languages being case sensitive.
(我知道区分大小写的缺点如今已经被良好的IDE所弥补)
(I know that the disadvantages of case sensitivity are now-a-days complemented by good IDEs)
我仍然想知道,如果区分大小写,那么编程语言是否有任何优势。为什么有许多流行语言的设计师选择使它们区分大小写?
Still I would like to know whether there are any advantages for a programming language if it is case sensitive. Is there any reason why designers of many popular languages chose to make them case sensitive?
编辑:
编辑:(我不敢相信我问过几年前是这个问题)
(I cannot believe I asked this question a few years ago)
推荐答案
这是一个偏好设置。我更喜欢区分大小写,我发现这样更容易阅读代码。例如,变量名 myVariable具有与 MyVariable, MYVARIABLE和 myvariable不同的词形。这样一眼便可以将两个标识符区分开来。当然,您不应或很少创建仅大小写不同的标识符。这与一致性有关,而不是增加可能的标识符数量这一明显的好处。有人认为这是一个缺点。在任何情况下,我都无法想到灵敏度给我带来了任何问题。但这又是一种偏爱。
This is a preference. I prefer case sensitivity, I find it easier to read code this way. For instance, the variable name "myVariable" has a different word shape than "MyVariable," "MYVARIABLE," and "myvariable." This makes it more straightforward at a glance to tell the two identifiers apart. Of course, you should not or very rarely create identifiers that differ only in case. This is more about consistency than the obvious "benefit" of increasing the number of possible identifiers. Some people think this is a disadvantage. I can't think of any time in which case sensitivity gave me any problems. But again, this is a preference.
这篇关于区分大小写的编程语言有什么优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!