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.

Go Proposal: Blank types as an alternative to generics for Go 2

2 pointsby c8galmost 8 years ago

3 comments

stewbrewalmost 8 years ago
&gt; At runtime however they are simply passed as interface{} values wrapping the real values since the type soundness already has been proven.<p>So, this is some sort of limited Java-like generics with type erasure?<p>As someone who has only dabbled shortly with Go just to find out that he prefers a slightly more complex language, I find this sort of proposals tyring. I&#x27;d reconsider using Go if they finally got this thing right, but until then ...<p>I personnally would find the lack of generics acceptable, if go had (some sort of) algebraic types. But since the go team thinks these are useless either ... In some room in some building this probably makes some sense.
al2o3cralmost 8 years ago
<p><pre><code> The compilation of a function that deals with a generic type would need to be redone for each concrete type the function is used with (including non builtin types) to allow proper allocation etc. </code></pre> Isn&#x27;t this essentially what&#x27;s required to get type-safe &quot;generic&quot; code currently in Go, only with manual copy-pasting&#x2F;codegen by the programmer instead of the compiler?
andreasgonewildalmost 8 years ago
Uh oh, someone invented Java-style &quot;generics&quot; again...<p>Seriously, static typing without proper parameterized types isn&#x27;t going anywhere; just do it and get it over with. Watching the Go-community is like a flashback to Steve Jobs arguing for the one-button mouse.