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


大部分语言都用尖括号<>表示泛型,为什么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
  • 大家游泳后洗完澡是在里面穿好衣服还是裸着出来穿衣服呢?

    查看案例

  • Windows下如何阻止电脑休眠?

    查看案例

  • Rust使用?多次传播错误后,怎么定位最开始发生error的地方?

    查看案例

  • 怎么学习前端开发?求推荐学习路线?

    查看案例

  • docker有哪些有趣的用途?

    查看案例

  • 目前中国程序员和美国程序员的差距在哪里?

    查看案例

  • 为什么 mac mini 的 m4 版本价格这么低呢?

    查看案例

  • golang总体上有什么缺陷?

    查看案例