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


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

更新时间:2025-06-20 18:30:15

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

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
  • 为什么男生都不喜欢173身高的女生啊?

    查看案例

  • 鸿蒙电脑正式发布,今年的大一新生会不会扎堆购买鸿蒙电脑?

    查看案例

  • 你的亲戚提过什么过分的要求?

    查看案例

  • 缅甸女生想不想嫁到云南(中国)?

    查看案例

  • 老饭骨做的饭真的好吃吗 ?

    查看案例

  • 为什么许多人讲虹鳟不是三文鱼?

    查看案例

  • 如何评价苹果 3 月 5 日发布的 MacBook Air M4,相比前代有哪些提升?

    查看案例

  • PHP初学者,我能不能使用PHP来开发桌面应用?

    查看案例