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


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

更新时间:2025-06-21 16:05:12

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

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
  • 印度是真的烂还是咱们在信息茧房里面?

    查看案例

  • 你为什么对kotlin失去好感?

    查看案例

  • Office 中为何还要保留 Access 数据库?

    查看案例

  • 夫妻开饭店双双确诊乳腺癌,职业性暴露于烹饪油烟是乳腺癌独立风险因素,日常应做好哪些防护?

    查看案例

  • postgres集群的选择?

    查看案例

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

    查看案例

  • 为什么没人提微软裁员?

    查看案例

  • golang 与rust 在服务器程序领域相比较,各有什么优劣势?

    查看案例