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


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

更新时间:2025-06-24 01:35: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
  • J***aScript 已经强大到什么程度了?

    查看案例

  • 如何看待 2026QS 世界大学排名?

    查看案例

  • 为什么越来越多的 SSD 不带片外缓存了?

    查看案例

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

    查看案例

  • 伊朗这次让以色列打惨了,这个国家还能挺过来吗?

    查看案例

  • 好的游戏设计有很多,有些也不难在程序上实现,为什么很多新游戏还是不会用已有的好的设计呢?

    查看案例

  • Gemini Advanced 和 aistudio有什么区别?

    查看案例

  • 魔兽世界为什么把抗性属性去除了?

    查看案例