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


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

更新时间:2025-06-21 13:15: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
  • 为什么感觉wps的用户越来越多,office没人用了?

    查看案例

  • 想学编程,该不该买MacBook?

    查看案例

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

    查看案例

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

    查看案例

  • golang有哪些不错的游戏服务器框架?

    查看案例

  • 中国发动机是技术落后,还是材料技术没有攻克?

    查看案例

  • 下载怎么老阻止?

    查看案例

  • 如何评价首个女性友好的编程语言HerCode?

    查看案例