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


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

更新时间:2025-06-23 08:00: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
  • 全平台应用框架会是趋势吗?flutter、tauri、maui你更看好哪一个?

    查看案例

  • 有哪些是你用上了mac才知道的事?

    查看案例

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

    查看案例

  • 新买了一台nas,第一个月下载20t+,上传5+,不会被网警盯上吧?

    查看案例

  • PHP现在真的已经过时了吗?

    查看案例

  • 有一个乌克兰的朋友问我,中国人凭什么能享受和平,我该怎么说?

    查看案例

  • 如果郭嘉把大家的房贷都免掉了,会刺激消费吗?

    查看案例

  • 如何评价首个女性友好的编程语言HerCode?

    查看案例