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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Leveraging Static Typing to Manage Object State

25 点作者 gpoort超过 10 年前

3 条评论

fsloth超过 10 年前
&quot;...whose type indicates its state&quot;<p>This is one of my favorite scenarios facilitated by static types. And one of the reasons I like languages with ML-like syntax for algebraic datatypes and pattern matching - this pattern is so easy to implement in them<p><a href="http://en.wikipedia.org/wiki/Algebraic_data_type" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Algebraic_data_type</a><p>An concise example of the usage can be found in <a href="http://queue.acm.org/detail.cfm?id=2038036" rel="nofollow">http:&#x2F;&#x2F;queue.acm.org&#x2F;detail.cfm?id=2038036</a><p>(Section starting with the sentence &quot;Consider as an example the following types for representing the state of a network connection:&quot;)<p>That&#x27;s in Ocaml but the same syntax applies more or less to all languages with ADT:s.
gsg超过 10 年前
Ah, a clear instance of <a href="http://blogs.msdn.com/b/oldnewthing/archive/2011/01/26/10120297.aspx" rel="nofollow">http:&#x2F;&#x2F;blogs.msdn.com&#x2F;b&#x2F;oldnewthing&#x2F;archive&#x2F;2011&#x2F;01&#x2F;26&#x2F;10120...</a>
评论 #8766730 未加载
ENGNR超过 10 年前
See also: Scala case classes