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


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

更新时间:2025-06-21 14:55:18

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

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
  • 为什么 Go 语言的 Error Handling 被某些人认为是一个败笔?

    查看案例

  • 那些168cm才80来斤的女生,真的现实生活中好看吗?

    查看案例

  • 有个身高175cm女友是什么体验?

    查看案例

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

    查看案例

  • 扫黑风暴为什么他们费老大劲杀这么多人不如直接把督导组干掉?

    查看案例

  • 紧身牛仔裤看起来不正经,真的是这样吗?

    查看案例

  • 为什么web worker可以在前端开多线程,解决单线程卡死页面的问题,但是没有得到广泛使用?

    查看案例

  • 如何评价Cursor?

    查看案例