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


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

更新时间:2025-06-23 03:10: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
  • 北京日报点名批评“苏超”过度娱乐化的动机是什么?

    查看案例

  • 如何看待《捞女游戏》定档 6 月 19 日?

    查看案例

  • 为什么从事技术的人普遍都比较难沟通?

    查看案例

  • 核武器最小当量能做到多少?

    查看案例

  • 如果你是《一帘幽梦》里的绿萍,你会不会最后原谅紫菱?

    查看案例

  • 如何看待伊朗发布10座美军基地地图?

    查看案例

  • 朱丹在《五十公里桃花坞》中重男轻女惹争议,针对该***你有哪些看法?

    查看案例

  • 如何评价张靓颖刘宇宁《九万字》?

    查看案例