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

2025-06-26 07:15: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要标新立异用中括号?
广告位810*200
相关阅读
汤姆·克鲁斯在国外算几线?

汤姆·克鲁斯在国外算几线?

这张是03年名利场的封面图,基本涵盖了当年一线男星,22年过...

2025-06-21
有没有免费的语音转文字的软件?

有没有免费的语音转文字的软件?

AsrTools2:功能特点:在 GitHub 上完全免费,...

2025-06-21
韩寒现在为什么不写书了呢?

韩寒现在为什么不写书了呢?

韩寒在10年前后搞了个杂志叫独唱团。 市场反响很好。 然...

2025-06-21
微信头像会影响第一印象吗?

微信头像会影响第一印象吗?

访达。 用Mac的朋友们应该都很熟悉吧。 就是这个玩...

2025-06-21
如何评价沙鲁?

如何评价沙鲁?

沙鲁带来的从来不是压迫感, 而是一种 身份认同被调换的恐惧感...

2025-06-21