为什么'新'和'做'不保留关键字? [英] Why are 'new' and 'make' not reserved keywords?
本文介绍了为什么'新'和'做'不保留关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
启用语法高亮功能后,在阅读对此问题的答案等代码时会分心新变量用作变量名称。
我试图想到为什么只有一小部分关键字会被保留,并且不能提供好的关键字。
编辑:此问题的替代标题:
为什么Go的预先声明的标识符未保留?
新和
make
并不是真正的解决方案 关键字,但内置函数。
如果您检查保留关键字的完整列表,您不会看到 len
或 cap
。 。
With syntax highlighting enabled, it's distracting while reading code like answer to this question with new used as a variable name.
I'm trying to think of a reason why only a subset of keywords would be reserved and can't come up with a good one.
Edit: Alternate title for this question:
Why are Go's predeclared identifiers not reserved ?
解决方案
That's because new
and make
aren't really keywords, but built-in functions.
If you examine the full list of the reserved keywords, you won't see len
or cap
either...
这篇关于为什么'新'和'做'不保留关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文