你现在的位置是:当前位置: 首页 >


大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?

更新时间:2025-06-22 01:20:15

最新的设计文档里面对这一块做了一个解释。

Why not use the syntax F like C++ and J***a? When parsing code within a function, such as v := F, at the point of seeing the < it's ambiguous whether we are seeing a type instantiation or an expression using the < operator. This is very difficult to resolve without type information. For example, consider a statement like a, b = w < x, y > (z) Withou…。

大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?

案例推荐

case recommendation
  • Trae和Cursor对比有什么优势吗?

    查看案例

  • 请问HDFS、TFS、GFS等分布式文件系统,哪个更适合用来做***存储?

    查看案例

  • 有哪些事,是社会底层人认识不到的?

    查看案例

  • 为什么Steam Deck能做好Windows游戏转译但是Apple Mac就做不好?

    查看案例

  • MongoDB的缺点以及你为什么不使用MongoDB?

    查看案例

  • 为啥 php 还有这么多人在用啊?

    查看案例

  • 老板说我设计了一周的海报还是不行,我到底该怎么学啊?

    查看案例

  • 国防大学教授公方彬说 : 俄罗斯的困境源于其选择了一条早被人类文明淘汰的大国强盛道路。怎样理解这话?

    查看案例