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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Go 1/2 Proposal: Immutable Types

19 点作者 romshark超过 6 年前
Hey guys, I just published the Go 1.x &#x2F; Go 2.x proposal to &quot;Immutable Types&quot; that I&#x27;ve been working on for the past month and it&#x27;s now official:<p>https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;27975<p>Please be sure to check it out and feel free to join the conversation! Even if this feature is never introduced to the language specification - reading the design document will make you a better Go developer, that I guarantee!<p>original design document: https:&#x2F;&#x2F;github.com&#x2F;romshark&#x2F;Go-1-2-Proposal---Immutability

1 comment

x0re4x超过 6 年前
Hi,<p>my humble opinion: how much would &quot;Immutable Types&quot; add to the language? How much complexity would it add? Things can already be made immutable from outside by hiding them in private variables&#x2F;struct elements.<p>The question is: why did Go became successful without having &quot;Immutable Types&quot;? (or &quot;Reference Types&quot;, ADTs too please?) Maybe those things are just frills, &quot;nice to have&quot; features.<p>Example like &quot;type ImmutableMapAndKey const map[const * const Object] const * const Object&quot; looks like really ugly Go to me... this is starting to look like C++...<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cQ7STILAS0M" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cQ7STILAS0M</a> (why Golang is Sucessful by Creator of Golang Rob-pike)<p>P.S.: I wouldn&#x27;t mind having &quot;Immutable Types&quot;, &quot;Reference Types&quot;, ADTs, etc. in Go. But not if it means abandoning simplicity of the language.
评论 #18127824 未加载
评论 #18133064 未加载
评论 #18128408 未加载