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


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

更新时间:2025-06-19 06:40:10

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

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
  • 每次去国外,别人一眼就看出我是中国人,是中国人身上有什么特质吗?

    查看案例

  • 蜂鸟音乐指控邓紫棋侵权,要求 48 小时内下架重录歌曲,邓紫棋回应「不会下架」,这一指控合理吗?

    查看案例

  • 为什么不用rust重写Nginx?

    查看案例

  • 编程语言 MoonBit 发布 Beta 版,正式进入企业场景应用,会带来哪些影响?

    查看案例

  • 小时候看过的影视剧情节,哪些给你留下了童年阴影?

    查看案例

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

    查看案例

  • 老板说我设计了一周的海报还是不行,我到底该怎么学啊?

    查看案例

  • go 有哪些成熟点的后台管理框架?

    查看案例