Hacker News new | ask | show | jobs
by scotth 4234 days ago
Honest question: How different is a web worker from an actor?
1 comments

Surprise answer: It's not.

When people sat down and decided how workers are to act in browsers - Actors are what they had in mind.

This is why Web Workers don't have access to the window scope, use explicit message passing etc.

So to reply to both of you:

Correct me please, but from what I understand web workers are not a part of the JavaScript language. The same way AJAX isn't a part of the JavaScript language. I would consider those (AJAX/WebWorkers) more like "system calls" to the browser. And like any system call, it has privileges the application doesn't.

To be precise:

- The JavaScript language is specified under the ECMAScript specification.

- Web workers are indeed not a part of the ECMAScript specification which considers them "host objects".

- WebWorkers and other browser APIs (timers, ajax etc) are called the DOM API. The DOM (document object model) is how JS interacts with the web page and what capabilities it exposes. (document.getElementById isn't any more JavaScript than web workers).