大部分语言都用尖括号<>表示泛型,为什么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备86625836号-1|网站地图
本文地址:
琼-ICP备86625836号-1|网站地图本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
后台-模块-广告管理-内容底部广告位
后台-模块-广告管理-内容底部广告位