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


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

更新时间:2025-06-24 03:55:10

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

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
  • 消息称三大运营商将于今年下半年全面重启eSIM,eSIM有哪些好处?为何此前暂停这一业务?

    查看案例

  • 中医把脉是***吗?

    查看案例

  • 紧身牛仔裤看起来不正经,真的是这样吗?

    查看案例

  • 广州拟全面取消房地产限购、限售、限价并降低贷款首付比例和利率,拟推动***运动消费发展,将产生哪些影响?

    查看案例

  • 男朋友说我穿衣服太开放,难道好身材不应该显示出来吗?

    查看案例

  • 为什么腾讯云或者阿里云不让自建dns服务器?

    查看案例

  • 怎么理解开源项目若依(RuoYi)存在的意义?

    查看案例

  • 用J***a写Android的时代是不是要结束了?

    查看案例