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


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

更新时间:2025-06-18 16:45:14

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

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
  • 苹果 macOS Tahoe 26 新 Finder 图标引争议,其争议点主要集中在哪些方面?

    查看案例

  • 苹果推出 TipKit,该工具包有什么功能?

    查看案例

  • 变形金刚在变形后比变形前大很多,是如何实现的?

    查看案例

  • lcd屏幕如此护眼,为什么现在没有了?

    查看案例

  • 央行等六部门联合印发《关于金融支持提振和扩大消费的指导意见》,释放了什么信号?

    查看案例

  • 为什么男人大都喜欢比自己小的女人?

    查看案例

  • 如何评价《一人之下》第722(765)话情报?

    查看案例

  • 为什么百度搜索引擎越做越差?

    查看案例