TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Expectations for generics in Go 1.18

263 pointsby smasher164over 3 years ago

12 comments

Benjammerover 3 years ago
Thank god, this guy[0] can finally cut over to native generics in his code.<p>[0]: <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;5penft&#x2F;parallelizing_enjarify_in_go_and_rust&#x2F;dcsgk7n&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;5penft&#x2F;parallelizing_...</a>
评论 #29021485 未加载
评论 #29022044 未加载
评论 #29021812 未加载
评论 #29023085 未加载
评论 #29022823 未加载
评论 #29023371 未加载
评论 #29021989 未加载
dgunayover 3 years ago
Very reasonable caveats for a feature as big as generics.<p>Personally, I&#x27;m super excited for the potential generics has to make error handling in Go less noisy, so I&#x27;ll be attempting to use it ASAP.
评论 #29021329 未加载
评论 #29021340 未加载
评论 #29023174 未加载
oefrhaover 3 years ago
Related discussion from 10 days ago:<p><i>go: don&#x27;t change the libraries in 1.18</i><p><a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;48918" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;48918</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28895440" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28895440</a>
SheinhardtWigCoover 3 years ago
If you want to get a head start, gotip makes it easy to build and run go from the development tree:<p><a href="https:&#x2F;&#x2F;pkg.go.dev&#x2F;golang.org&#x2F;dl&#x2F;gotip" rel="nofollow">https:&#x2F;&#x2F;pkg.go.dev&#x2F;golang.org&#x2F;dl&#x2F;gotip</a>
rsj_hnover 3 years ago
Had a long running bet that NCIS would be cancelled before Go got generics. Now it looks like I must eat my words.
评论 #29023568 未加载
jimbob45over 3 years ago
Does anyone know the impetus for using [] in generics? I know Nim opted for the same syntax and I assume it has some parsing&#x2F;tokenizing benefit like the switch to using “fn” a la Zig or Rust. However, the syntax seems needlessly ambiguous with array notation sharing the same operator. I know I’m not alone because I’ve seen others mirror my concerns on Nim forums [0].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;nim-lang&#x2F;Nim&#x2F;issues&#x2F;3502" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nim-lang&#x2F;Nim&#x2F;issues&#x2F;3502</a>
评论 #29021430 未加载
评论 #29021539 未加载
评论 #29021396 未加载
评论 #29021973 未加载
评论 #29021415 未加载
评论 #29021452 未加载
评论 #29021609 未加载
hota_maziover 3 years ago
&gt; Because we will not know what the best practices are for using generics,<p>Well, you could... take a look at languages created these past twenty years that support generics, learn lessons from that, and see how these lessons could apply to Go.<p>But well, the Go team is not exactly known for paying much attention to the state of programming language theory, so I guess that&#x27;s out.
评论 #29022857 未加载
评论 #29022566 未加载
评论 #29025373 未加载
评论 #29024049 未加载
评论 #29023859 未加载
评论 #29022641 未加载
VHRangerover 3 years ago
How are they implemented?<p>Compile time? With template expansion like D and C++?
评论 #29021426 未加载
评论 #29021433 未加载
samtheprogramover 3 years ago
From the outside, it seems like adding generics to Go seems similarly controversial and slow as the Python jump to version 3 — although Go generics haven’t even landed yet.<p>Generics have the potential to impact a decent amount of the standard library. Although I’m not surprised that they are not doing a major version bump given the isolation of the feature at this stage, it will be interesting to observe its uptake in the community and whether fragmentation occurs over what is supported and what isn’t given their recommendation of isolating generics-related code in third party libraries.
评论 #29022486 未加载
vptrover 3 years ago
&gt; We expect that some package authors will be eager to adopt generics. If you are updating your package to use generics, please consider isolating the new generic API into its own file, build-tagged for Go 1.18 (&#x2F;&#x2F;go:build go1.18), so that Go 1.17 users can keep building and using the non-generic parts.<p>I have a feeling this won&#x27;t happen.
评论 #29021402 未加载
awestrokeover 3 years ago
And so Go is one step closer to being a real programming language in many people&#x27;s eyes.
评论 #29025255 未加载
评论 #29023137 未加载
评论 #29022903 未加载
pjmlpover 3 years ago
Finally catching up with modern times.
评论 #29025879 未加载