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


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

更新时间:2025-06-21 22:30: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
  • 为啥arm架构比x86 x64省电?

    查看案例

  • python的包管理器uv可以替代conda吗?

    查看案例

  • 蔡澜曾说「年轻人要存到 100 万以上,这是脱离牛马生活的第一步」,怎样看这一观点?

    查看案例

  • 如何看待 稚晖君第五轮融资 估值将达70亿?

    查看案例

  • 2025 江西高考本科线历史类 486 分,物理类 429 分较去年降 19 分,怎样看待江西分数线?

    查看案例

  • 实体店为什么生意越来越难做了?

    查看案例

  • 为什么当领导的不能把话说明白?

    查看案例

  • 索尼互动娱乐宣布 PS6 的开发工作已经全面启动,你会如何期待索尼的下一代游戏主机呢?

    查看案例