<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《Go泛型真的要来了！最早在Go 1.17版本支持》的评论</title>
	<atom:link href="http://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/feed/" rel="self" type="application/rss+xml" />
	<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/</link>
	<description>一个程序员的心路历程</description>
	<lastBuildDate>Fri, 17 Apr 2026 15:31:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7538</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Sun, 28 Feb 2021 08:26:55 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7538</guid>
		<description>最新的变化是选择了方括号[]。</description>
		<content:encoded><![CDATA[<p>最新的变化是选择了方括号[]。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：megumi</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7537</link>
		<dc:creator>megumi</dc:creator>
		<pubDate>Sat, 27 Feb 2021 10:33:41 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7537</guid>
		<description>挺搞的，竟然选了小括号，方便了工具而让人类去承受混淆</description>
		<content:encoded><![CDATA[<p>挺搞的，竟然选了小括号，方便了工具而让人类去承受混淆</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：苍红之刀</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7517</link>
		<dc:creator>苍红之刀</dc:creator>
		<pubDate>Mon, 09 Nov 2020 03:45:13 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7517</guid>
		<description>很像rust的泛型绑定约束。</description>
		<content:encoded><![CDATA[<p>很像rust的泛型绑定约束。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：狗</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7479</link>
		<dc:creator>狗</dc:creator>
		<pubDate>Thu, 06 Aug 2020 06:01:16 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7479</guid>
		<description>“习惯的”后方有加 &lt; 与 &gt; ，看来没被转译

博主要小心被恶意注入 JS</description>
		<content:encoded><![CDATA[<p>“习惯的”后方有加 &lt; 与 &gt; ，看来没被转译</p>
<p>博主要小心被恶意注入 JS</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：狗</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7478</link>
		<dc:creator>狗</dc:creator>
		<pubDate>Thu, 06 Aug 2020 05:58:59 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7478</guid>
		<description>还是不喜欢这个设计，尤其是不用更多人习惯的  这点

还有其中一个例子不靠泛型也没问题：
```
func Stringify(type T Stringer)(s []T) (ret []string) {
    for _, v := range s {
        ret = append(ret, v.String())
    }
    return ret
}
```
完全可以直接写
```
func Stringify(s []Stringer) (ret []string) {
    for _, v := range s {
        ret = append(ret, v.String())
    }
    return ret
}
```

觉得 Go 太过于执着简单反而让自己变得一点也不简单</description>
		<content:encoded><![CDATA[<p>还是不喜欢这个设计，尤其是不用更多人习惯的  这点</p>
<p>还有其中一个例子不靠泛型也没问题：<br />
“`<br />
func Stringify(type T Stringer)(s []T) (ret []string) {<br />
    for _, v := range s {<br />
        ret = append(ret, v.String())<br />
    }<br />
    return ret<br />
}<br />
“`<br />
完全可以直接写<br />
“`<br />
func Stringify(s []Stringer) (ret []string) {<br />
    for _, v := range s {<br />
        ret = append(ret, v.String())<br />
    }<br />
    return ret<br />
}<br />
“`</p>
<p>觉得 Go 太过于执着简单反而让自己变得一点也不简单</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：skyfire</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7465</link>
		<dc:creator>skyfire</dc:creator>
		<pubDate>Sat, 25 Jul 2020 09:34:37 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7465</guid>
		<description>感觉go的泛型还是不够灵活，对接口的条件限制完全可以在编译期检测出来，把这个任务交给程序员感觉有些多余了
比如：
func Add(type T)(a, b T) T {
    return a+b
}
调用Add(5,6)和调用Add(&quot;hello&quot;, &quot;world&quot;)，或者调用Add(5, &quot;hello&quot;)，编译期实例化的时候编译器完全有能力检测出哪些合法，哪些不合法呀，这样可以减轻开发者很大一部分工作量，不明白为什么不这么设计</description>
		<content:encoded><![CDATA[<p>感觉go的泛型还是不够灵活，对接口的条件限制完全可以在编译期检测出来，把这个任务交给程序员感觉有些多余了<br />
比如：<br />
func Add(type T)(a, b T) T {<br />
    return a+b<br />
}<br />
调用Add(5,6)和调用Add(“hello”, “world”)，或者调用Add(5, “hello”)，编译期实例化的时候编译器完全有能力检测出哪些合法，哪些不合法呀，这样可以减轻开发者很大一部分工作量，不明白为什么不这么设计</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7456</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Mon, 22 Jun 2020 23:02:58 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7456</guid>
		<description>感谢提醒。的确被markdown插件转换错了。在星号前加上反斜线解决了。看来这个问题由来已久了，看来以后写文章时不能“偷懒”了。该加“\&quot;的地方不能落下。</description>
		<content:encoded><![CDATA[<p>感谢提醒。的确被markdown插件转换错了。在星号前加上反斜线解决了。看来这个问题由来已久了，看来以后写文章时不能“偷懒”了。该加“\”的地方不能落下。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：kumakichi</title>
		<link>https://tonybai.com/2020/06/18/the-go-generics-is-coming-and-supported-in-go-1-17-at-the-earliest/#comment-7454</link>
		<dc:creator>kumakichi</dc:creator>
		<pubDate>Sun, 21 Jun 2020 13:22:01 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=2920#comment-7454</guid>
		<description>博主,

那么这将意味着类型A要作为T的实参传入，A必须满足Constraint(接口)。并且Constraint中的所有方法(如果有的话）都仅能通过A实例调用。

以及

我们看到Settable的方法集合是空的，而Settable的方法集合(method set)包含了Set方法。因此，Settable是满足Setter对FromStrings函数的类型参数的约束的。

这两个地方的星号被页面解析错了吧？</description>
		<content:encoded><![CDATA[<p>博主,</p>
<p>那么这将意味着类型A要作为T的实参传入，A必须满足Constraint(接口)。并且Constraint中的所有方法(如果有的话）都仅能通过A实例调用。</p>
<p>以及</p>
<p>我们看到Settable的方法集合是空的，而Settable的方法集合(method set)包含了Set方法。因此，Settable是满足Setter对FromStrings函数的类型参数的约束的。</p>
<p>这两个地方的星号被页面解析错了吧？</p>
]]></content:encoded>
	</item>
</channel>
</rss>
