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


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

更新时间:2025-06-21 18: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
  • 如何看待德转更新王钰栋身价为 150 万欧元,比之前暴涨 110 万欧元?

    查看案例

  • 据说go和c#的开发者都说自己比较节省内存,你们认为呢?

    查看案例

  • 特朗普表示美军阅兵式将超越奥运会或世界杯,这背后的意义和成本如何评估?

    查看案例

  • 养乌龟如何降低换水频率?

    查看案例

  • 央行宣布八项重磅金融开放举措,将设立数字人民币国际运营中心等,释放了哪些信号?

    查看案例

  • 为什么《歌手》不请周杰伦、陈奕迅、王菲、张学友、孙燕姿、梁静茹、王力宏、林俊杰当节目嘉宾?

    查看案例

  • 如何评价刘亦菲?

    查看案例

  • 曾经的班花,现在还多少人惦记?

    查看案例