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


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

更新时间:2025-06-21 14:20:17

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

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
  • 身体上的哪些迹象表明你正在衰老?

    查看案例

  • 有哪些是你用上了mac才知道的事?

    查看案例

  • 能分享一下你写过的rust项目吗?

    查看案例

  • 中国有能打到美国本土的导弹吗……有的话最远能打到哪里呢?

    查看案例

  • 女朋友学音乐的,给我备注 B大调音阶 是什么含义呢?

    查看案例

  • 美国真会下场对伊朗开战吗?

    查看案例

  • 为什么好多人不承认大众审美就是喜欢白皮?

    查看案例

  • 如何评价英伟达 NVIDIA 的总裁黄仁勋?

    查看案例