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


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

更新时间:2025-06-24 12:45:18

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

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
  • 一名女子在杭州万象城遭挟持被捅 20 多刀,隆胸***体救了一命,这反映出哪些公安系统的问题?

    查看案例

  • 深圳的人口最终会剩下多少?

    查看案例

  • 为什么当今 Web 应用不都***用 WebSocket 形式进行数据交互?

    查看案例

  • 尼康的镜头里哪款拍摄人像好呢?

    查看案例

  • 折叠屏手机有哪些有用或好玩的功能,你过去不理解,现在离不开?

    查看案例

  • 一个非常漂亮的残疾女孩,会有人愿意娶吗?

    查看案例

  • 如何设计一条 prompt 让 LLM 陷入死循环?

    查看案例

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

    查看案例