TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Gen - a generics library for Go

104 点作者 hebz0rl超过 11 年前

7 条评论

shurcooL超过 11 年前
Here is someone trying to come up with a good solution for generics, rather than simply complaining it don't exist. I am thankful for the effort.
评论 #7044489 未加载
评论 #7045818 未加载
评论 #7045499 未加载
评论 #7050797 未加载
mwsherman超过 11 年前
Author here, pleasantly surprised to see this on HN.<p>There is a substantial set of changes happening out on this branch: <a href="https://github.com/clipperhouse/gen/tree/projection" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clipperhouse&#x2F;gen&#x2F;tree&#x2F;projection</a>.<p>… for this reason: <a href="https://github.com/clipperhouse/gen/issues/8" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clipperhouse&#x2F;gen&#x2F;issues&#x2F;8</a>
stiff超过 11 年前
I really hope this will get solved in the language itself, I like Go quite a bit, but there are quite ugly places, all related to generics I guess:<p>- No min&#x2F;max for integers (and Go doesn&#x27;t have the ternary operator)<p>- No IsMember for checking if an object is in a collection<p>- Directly from the Gen page: <i>Go’s sort package requires the fulfillment of three interface members, two of which are usually boilerplate. If you want to sort by different criteria, you need to implement multiple ‘alias’ types.</i><p>Also, unrelated to generics, but no multidimensional arrays.
评论 #7045521 未加载
c-a超过 11 年前
Why call it a library when it&#x27;s a code generator&#x2F;compiler?
评论 #7044769 未加载
评论 #7044492 未加载
LukeShu超过 11 年前
This looks similar to an older generics system for Go, `got` (GO Templates). Got was pretty cool, but Go 1.0 broke it due to the parser getting stricter.<p>Edit: found it: <a href="https://github.com/droundy/gotgo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;droundy&#x2F;gotgo</a>
mseepgood超过 11 年前
These higher-order functions are a very inefficient way to write loops in Go. When you chain them you will end up with multiple sequential iterations instead of only one. Sort should not allocate and return a new slice, it&#x27;s better to sort in-place, etc.
评论 #7045330 未加载
评论 #7044733 未加载
Xelom超过 11 年前
Thanks for your effort. This is not about the library. Your site&#x27;s mobile version is kinda broken. The left menu thingy always remain in the site and you can&#x27;t read the main context. This happened to me on my Android Firefox Browser.
评论 #7046269 未加载