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


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

更新时间:2025-06-22 00:50:11

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

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起个名字,真以为人们记得住分得清吗?

    查看案例

  • 央企的信创,是否有必要把 spring 替换成国产的 solon ?

    查看案例

  • 是什么原因导致HDR无法推行?

    查看案例

  • Electron 和当下其他的桌面开发方法相比如何?

    查看案例

  • 空调现在抽真空15分钟真的还有意义吗?

    查看案例

  • 为什么 macOS 并不差,可市场总敌不过 Windows?

    查看案例

  • 你还在玩《魔兽世界》吗?

    查看案例

  • 如何评价仓颉编程语言7月30日开源?

    查看案例