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


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

更新时间:2025-06-25 14:30:13

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

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
  • 如何评价首个女性友好的编程语言HerCode?

    查看案例

  • 汉语是牺牲了什么,才成为世界最紧凑、最高效的语言?

    查看案例

  • 能够自己一个人创业的全栈web码农fullstack developer要会哪些技术?

    查看案例

  • 男人一般是从多少岁开始颜值下跌?

    查看案例

  • 怎么评价fastjson2?

    查看案例

  • 2025年,Gitea 和 GitLab 应当如何选择?

    查看案例

  • 郑钦文的饭圈开始互撕,对郑钦文的名声有什么影响?郑钦文超话是否应该关闭?

    查看案例

  • 若是和异性入住宾馆违法吗?

    查看案例