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


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

更新时间:2025-06-19 19:25:11

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

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
  • 为什么中国的英语教育这么失败?

    查看案例

  • 我国004号航母什么时候下水?

    查看案例

  • 为什么web worker可以在前端开多线程,解决单线程卡死页面的问题,但是没有得到广泛使用?

    查看案例

  • 如何评价人民网评关于集中整治违规吃喝的发文?

    查看案例

  • 如何评价《歌手 2025》第六期所有歌手的演唱?

    查看案例

  • 中国军队有多强,在世界能排第几?

    查看案例

  • 如果全球都停止出口粮食,中国能否自给自足?

    查看案例

  • ***拍大尺度片子时摄影师不会看光吗?

    查看案例