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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Get to Know the Actor Model with JavaScript

85 点作者 roperzh超过 7 年前

10 条评论

aryehof超过 7 年前
&gt; &quot;If this sounds to you a lot like Object-Oriented Programming (OOP), you are right.&quot;<p>This sounds like Alan Kay&#x27;s aspirational viewpoint of independent &quot;computers&quot; interacting through messages. Not the object-orientation invented by Nygaard and Dahl in Simula, that introduced objects, classes, subclassing and virtual functions. Kay&#x27;s vision is not reflected in modern object-oriented languages, while Nygard and Dahl&#x27;s remain paramount.<p>The argument that the Actor Model is really a form of object-oriented programming is an unrequired appeal to credibility.<p>Edit: grammar
评论 #15181444 未加载
partycoder超过 7 年前
The actor model deals with concurrent computation.<p>The threading models on node and browsers do not allow concurrent computation, except for the case of web workers, and the proposed threading additions of JavaScriptCore.<p>Because of this, the actor model can be overkill when you have no threads. More specifically, you may introduce queuing where no queuing (or other type of synchronization) is necessary. This is because an actor is basically a worker with a work queue (aka mailbox).<p>For the most part promises can solve most of your async issues. Event emitting&#x2F;message passing is valuable, but queuing is optional in many cases.
评论 #15180805 未加载
walkingolof超过 7 年前
There is a Javascript &quot;port&quot; of Akka , called Akka.js <a href="https:&#x2F;&#x2F;github.com&#x2F;akka-js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;akka-js</a><p>Scala.js, Scala that compiles to Javascript, enabling all of this. <a href="https:&#x2F;&#x2F;www.scala-js.org" rel="nofollow">https:&#x2F;&#x2F;www.scala-js.org</a><p>Try it out !
评论 #15182726 未加载
kevmo314超过 7 年前
How does this differ from a Redux-type store besides being able to instantiate them on demand instead of having a global state?<p>&gt; It’s easy to screw up immutability in JavaScript, the actor internal state can be modified externally if users of the library are not extremely careful.<p>Object.freeze() can help prevent this.
评论 #15181149 未加载
评论 #15180270 未加载
评论 #15182791 未加载
innocentoldguy超过 7 年前
I think a better language to understand the Actor Model with is Elixir. The Actor Model&#x27;s main point is concurrency. It is hard to demonstrate that in a language that doesn&#x27;t support concurrency.
评论 #15182117 未加载
评论 #15181832 未加载
prodtorok超过 7 年前
For those who like to learn from videos, here is an interview&#x2F;lesson from Carl Hewitt (he introduced the model):<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=7erJ1DV_Tlo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=7erJ1DV_Tlo</a>
kroltan超过 7 年前
This blog is almost unreadable. the font is WAY too thin on Firefox!
评论 #15186210 未加载
imafish超过 7 年前
Jesus! Are there any posts on HN these days that are not JavaScript or blockchain? (or a combination, describing 90% of blockchain projects....)<p>On topic: I don&#x27;t see a use case, in which I would need to use the actor model and would pick javascript as my language of choice. However, I do think your article is well-written and explains the actor model quite well.
评论 #15184176 未加载
Dolores12超过 7 年前
&gt; let state = typeof behavior.init === &quot;function&quot; ? behavior.init() : {};<p>Javascript is such a mess itself, i don&#x27;t know how one can explain something in it. Choose python, reads like English.
评论 #15182828 未加载
评论 #15183162 未加载
评论 #15186702 未加载
评论 #15182784 未加载
lotusko超过 7 年前
yes,I like this design,and my system has applied it.I feel this theropy just like the domain-specific languague or system thought(the_Fifth_Discipline). best regards