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


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

更新时间:2025-06-23 22:20:16

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

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
  • 2025 国内公司前端团队都在搞些什么?

    查看案例

  • MacOS真的比Windows流畅吗?

    查看案例

  • 如何看待广西举全区之力支持柳州化解债务?为什么最近地方债又重回公众视野?

    查看案例

  • 为什么那些滥交的男女不怕染上***?

    查看案例

  • 如何评价张靓颖刘宇宁《九万字》?

    查看案例

  • 为什么有人觉得《庆余年》很垃圾?

    查看案例

  • Vue性能优于React,那为什么还不用Vue?

    查看案例

  • 27寸显示器有必要上4K吗?

    查看案例