大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?_新疆维吾尔自治区巴音郭楞蒙古自治州尉犁县佳楚谋密种植机械有限合伙企业

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

后台-模块-广告管理-内容头部广告位
后台-模块-广告管理-内容头部广告位

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

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要标新立异用中括号?

吉-ICP备82487340号-1|网站地图
本文地址:
吉-ICP备82487340号-1|网站地图本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
后台-模块-广告管理-内容底部广告位
后台-模块-广告管理-内容底部广告位

上一篇 : 人,可以废物到什么程度?

上一篇 : 人,可以废物到什么程度? "> 条评论)

快来评论,快来抢沙发吧~