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


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

更新时间:2025-06-23 07:30:10

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

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
  • 群晖 nas 有些什么基本和好玩的功能?

    查看案例

  • 我是新手想养鱼,预算不超过200。有什么好的建议或者禁忌吗。?

    查看案例

  • 伊朗为什么不买中国战机,却坚持四十年用老旧的苏联米格29、美国F14雄猫战斗机?

    查看案例

  • 我听说Windows12微软就直接重头构建Windows了,就直接重构Win内核了,到底是不是真的?

    查看案例

  • 如何看待Ollama基于Go语言开发而不是别的编程语言?

    查看案例

  • 群晖 nas 有些什么基本和好玩的功能?

    查看案例

  • 为什么米哈游不自己搞个***网站?

    查看案例

  • 今年西瓜收购价只有 2 毛一斤,有瓜农把西瓜扔池塘,现在超市西瓜仍几元一斤,为何会这样?

    查看案例