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


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

更新时间:2025-06-21 11:15: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
  • 2024MacBookPro14寸选择m4标准版(10核心)32+512还是M4Pro(12核心)?

    查看案例

  • 只能选一个,你选谁?

    查看案例

  • 上海东方明珠被曝观光廊一块玻璃地板热炸了,这种钢化玻璃真能热炸吗?高温天气去景区玻璃走廊安全吗?

    查看案例

  • 独立开发者都使用了哪些技术栈?

    查看案例

  • 为什么很多公司都不招大龄码农?

    查看案例

  • 小区有人去世办丧事,早上5点放音乐,我报警有错吗?

    查看案例

  • 为什么都认为无GC语言一定会比有GC语言要快?

    查看案例

  • 穿瑜伽裤爬山的女生会不会害羞?

    查看案例