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


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

更新时间:2025-06-22 02:05: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
  • 1MB其实是一个很大的存储单位,那么它的存储容量究竟有多大?

    查看案例

  • 中国现有的雷达技术能发现B2么?

    查看案例

  • 怎么看待三十而已里说的养鱼让人玩物丧志,养鱼是魔鬼,是黑洞,养鱼毁三代鱼缸毁一生的话?

    查看案例

  • 有没有什么路由器让你用过之后彻底惊艳了?

    查看案例

  • Go 语言的使用感受是什么?

    查看案例

  • 为什么macOS软件生态不敌Windows?

    查看案例

  • 做个web服务器,gin框架和go-zero怎么选?

    查看案例

  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例