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


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

更新时间:2025-06-18 14:35:14

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

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
  • 华为 HDC 发布 HarmonyOS 6 开发者 beta 版对应用开发者和鸿蒙生态有哪些影响?

    查看案例

  • 北京日报点名批评“苏超”过度娱乐化,它是否管的太宽了?为什么无良媒体不会被查封取缔?

    查看案例

  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例

  • 如何评价switch 2版赛博朋克2077的画面堪比xss?

    查看案例

  • 你为什么对kotlin失去好感?

    查看案例

  • 缅甸女生想不想嫁到云南(中国)?

    查看案例

  • 有没有一个特别好用的Linux系统?

    查看案例

  • 水浒传里潘金莲到底有多漂亮?

    查看案例