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


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

更新时间:2025-06-22 12: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
  • 如何看待健身锻炼到最后一身伤病?

    查看案例

  • 把贵州省撤销,设立一个超大型国家自然公园,是不是一个好的提法?

    查看案例

  • 不喜欢老婆找健身房男教练私教,是我太狭隘了吗?

    查看案例

  • 超小团队选择Django还是Flask?

    查看案例

  • 如今无损音乐已经很普遍,为什么发烧者们始终喜欢用CD碟片听音乐?

    查看案例

  • 为什么全世界无一人能实现新mac直接全功能稳定装Win 11 arm,或PC直接装macOS arm?

    查看案例

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

    查看案例

  • 如何评价华为最新长焦专利技术?能否颠覆手机长焦摄影的目前限制?

    查看案例