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


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

更新时间:2025-06-24 04:25: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
  • 女生微胖到底是种什么体验?

    查看案例

  • 周杰伦为什么不告粥饼伦黑伦侵犯他的名誉权?

    查看案例

  • 求推荐程序开发笔记本!?

    查看案例

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

    查看案例

  • 手术时把大脑拿出来还能接回去吗?

    查看案例

  • SwiftUI 是不是一个败笔?

    查看案例

  • 真的有这种又苗条身材又爆炸的么?

    查看案例

  • 程序员平时都是CRUD开发工作,真的需要深入理解原理性的知识点吗?

    查看案例