Message from JavaScript discussions
October 2018
— Yes I understand it. Thanks
Soon I will be also implementing Golang-like channels for JS... it will be crazy to see this in JS
const myChannel = new Channel("string");
spawn function() { myChannel <- "Hello!" };
console.log(<-myChannel);
— You can't tell how powerful this is... by just looking at this basic example
— But essentially, the function after spawn
runs concurrently
— And the code calling spawn
infact also runs concurrently
— So there can be channels of communication across several concurrent functions, without having to return/yield between them
— Why not just use Promise like semantics and fork a function call into a thread, and pass the return value back as the promise's resolv?
— Why do we need new syntax?
— Do you mean, why do we want to leave the old ways?
— It is not just new syntax
— You can easily write your own promise wrapper over it... it allows far more than this promise behavior
— It is leaving the whole event loop execution model