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


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

更新时间:2025-06-22 23:20: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
  • 男朋友因为打游戏骗我去睡觉被我识破,然后我提了分手,他同意了,问问男孩子们他怎么想的?

    查看案例

  • 吃爽了是怎样一种体验?

    查看案例

  • 男女宇航员怎么解决生理需求?

    查看案例

  • Rust的工程配置为何用toml格式?

    查看案例

  • 苹果为什么要给每代MacOS起个名字,真以为人们记得住分得清吗?

    查看案例

  • 为什么健身的女性普遍喜欢晒臀照?什么心理?

    查看案例

  • Golang 中为什么没有注解?

    查看案例

  • 为什么各大品牌内存条包装都那么low?

    查看案例