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


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

更新时间:2025-06-22 15:30:16

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

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你更看好哪一个?

    查看案例

  • 游戏王里有哪些「名不副实」的卡?

    查看案例

  • 以色列为什么要打伊朗?

    查看案例

  • 国产手机AI「好用」的背后,是技术差距还是文化差异?

    查看案例

  • 为什么微信不向telegram学习?

    查看案例

  • Manus会不会开源?

    查看案例

  • 如何评价***伊内斯·特洛奇亚的身材?

    查看案例