Go语言中的5个秘密关键字是什么?

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

What are the 5 secret keywords in Go?

问题

这个演讲中,Francesc Campoy展示了Go语言的25个关键字,其中有5个“秘密”关键字。

Go语言的5个秘密关键字是什么?

英文:

In this talk, Francesc Campoy has a slide with Go's 25 keywords, and apparently 5 'secret' keywords.

What are the 5 secret keywords in Go?

答案1

得分: 16

以下5个关键词被忽略:

尽管
事实
尽管有所有的反对意见
鉴于
在这个程度上

是的,真的


更新:正如Deleplace在评论中指出的那样,这些彩蛋关键词已被移除。在一个重大的解析器更新期间,看起来是通过这个提交将它们移除的。如果你尝试运行包含这些标记之一的程序,你会发现它们现在被视为普通的标识符。

英文:

The following 5 keywords are ignored:

notwithstanding
thetruthofthematter
despiteallobjections
whereas
insofaras

Yes, really.


Update: As Deleplace notes in the comments, the easter egg keywords have been removed. It looks like this commit took them out during a major parser update. If you try to run a program containing one of these tokens, you'll find they're treated as ordinary identifiers now.

答案2

得分: 8

词法分析器(lex.go)中存在一些复活节彩蛋关键词,这些关键词在官方文档中没有提到,因此编译器会忽略它们。

以下是这些关键词:

notwithstanding
thetruthofthematter
despiteallobjections
whereas
insofaras

你可以参考这个对话了解更多细节。

英文:

There are some easter egg keywords in the lexer (lex.go) that are not in the official documentation, and hence are ignored by the compiler.

Here they are:

notwithstanding
thetruthofthematter
despiteallobjections
whereas
insofaras

You can report to this conversation for more details.

答案3

得分: 3

看起来秘密关键字将在v1.10中被移除。请参见这里

对于任何好奇的人,这里是引入这些关键字的提交。

英文:

It looks like the secret keywords will be removed in v1.10. See here.

For anyone curious, here is the commit which introduced the keywords.

huangapple
  • 本文由 发表于 2016年8月22日 06:48:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/39069515.html
匿名

发表评论

匿名网友

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

确定