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


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

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

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

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
  • 伊朗这次让以色列打惨了,这个国家还能挺过来吗?

    查看案例

  • 牙齿是tooth,医生是doctor,那为什么牙医不是tooth doctor,而是dentist ?

    查看案例

  • 你最真实(很少吐露)的择偶标准是什么?

    查看案例

  • 国内玩爵士的人生活是怎样的?

    查看案例

  • 为何腰突不能去根,突出了就再也回不去了,一直压迫神经根,为什么发作的时候疼,不发作的时候就不疼?

    查看案例

  • 如何写出军工级的代码?

    查看案例

  • DF-41已经可以打击美国本土,这是否相当于古巴导弹危机常态化?

    查看案例

  • C罗赠送特朗普球衣:致唐纳德•特朗普总统,为和平而战。如何评价?

    查看案例