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


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

更新时间:2025-06-28 19:00: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
  • 伊朗那么大却被一个小小的以色列打的无法还手?很多高层领导都被干掉了为什么?

    查看案例

  • 高校里那些「非升即走」后「走」了的青年教师都怎么样了?

    查看案例

  • DLM(扩散语言模型)会成为2025年的Mamba吗?

    查看案例

  • 洲际导弹能打到任何地方,为什么还需要轰炸机?

    查看案例

  • 网络游戏服务器开发,有哪些经典书籍?

    查看案例

  • PHP初学者,我能不能使用PHP来开发桌面应用?

    查看案例

  • 为什么小男孩小时候要比小女孩难养好多?

    查看案例

  • 魔兽世界有必要4k吗?

    查看案例