Message from JavaScript discussions

October 2018

— I'm learning about bitcoin and needs to learn about concurrency, parallelism and multi-thread


This can all run in parallel, or at the same exact time:

2 + 2
100 + 100

but this can not run at the same time... the bottom addition must wait for the top addition to finish first:
var number = 2 + 2
number + 100

— Great!

— I hope I explained well :)

— 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!" };

Message permanent page

— 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

Message permanent page

— 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?

Message permanent page

— Why do we need new syntax?