ghost-lang icon indicating copy to clipboard operation
ghost-lang copied to clipboard

Thread syntax sugar

Open aleclarson opened this issue 7 years ago • 5 comments

It might be cool if there was syntax sugar for "threads" (the definition of which depends on the target platform). For example, threads would compile to web workers for a browser target.

aleclarson avatar Nov 01 '18 16:11 aleclarson

Ghost has reached a point where it would have to be compiled to Wasm which is starting to have support for threads now https://developers.google.com/web/updates/2018/10/wasm-threads

I'm not sure what's needed for syntax other than potentially a syntax for moving/copying values into closures to be spawned as a thread

jamiebuilds avatar Nov 01 '18 16:11 jamiebuilds

This looks a lot like a language I have been working on. Have you consider alternative concurrency models such as Actors or CSP?

SCKelemen avatar Nov 01 '18 16:11 SCKelemen

Actors, CSP, etc are things you would implement on top of threads. I think they would be more in the stdlib.

jamiebuilds avatar Nov 01 '18 16:11 jamiebuilds

Thoughts on cooperative threading vs preemptive threading?

aleclarson avatar Nov 01 '18 18:11 aleclarson

I don't think that needs to be true. CSP, Actors, and threads are all independent concurrency paradigms. All of them can be implemented completely independently and without any other, and each can be implemented on top of any other.

SCKelemen avatar Nov 03 '18 03:11 SCKelemen