Timeline for Why don't programming languages automatically manage the synchronous/asynchronous problem?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 3, 2019 at 8:29 | comment | added | Cinn | Elixir also seems pretty closed, I found this article very helpful: blog.codeship.com/comparing-elixir-go | |
Apr 3, 2019 at 6:51 | comment | added | user332375 | The OP asked "to be able to write asynchronous code in a synchronous way". As you have mentioned, with goroutines and the go runtime, you can exactly do that. You don't have to worry about the details of threading, just write blocking reads and writes, as if the code was synchronous, and your other goroutines, if any, will keep on running. You also don't even have to "await" or read from a channel to get this benefit. I therefore I think Go is programing language that meets the OP's desires most closely. | |
Apr 1, 2019 at 15:36 | comment | added | Deduplicator | @amon As far as I know, goroutines are cooperatively scheduled on native threads (normally just enough to max out true hardware parallelism) by the runtime, and those are preemptively scheduled by the OS. | |
Apr 1, 2019 at 12:47 | comment | added | amon |
While Goroutines are a kind of concurrency, I wouldn't put them into the same bucket as async/await: not cooperative coroutines but automatically (and preemptively!) scheduled green threads. But this doesn't make awaiting automatic either: Go's equivalent to await is reading from a channel <- ch .
|
|
Apr 1, 2019 at 8:33 | comment | added | Deduplicator |
@Cinn Actually, no. You can put any call as a goroutine onto its own fiber / green-thread with go . And just about any call which might block is done asynchronously by the runtime, which just switches to a different goroutine in the meantime (co-operative multi-tasking). You await by waiting for a message.
|
|
Apr 1, 2019 at 8:03 | comment | added | Cinn |
I almost never used the Go language but it seems that you explicitly declare go ... , so it looks similar as await ... no?
|
|
Apr 1, 2019 at 7:20 | review | First posts | |||
Apr 1, 2019 at 14:01 | |||||
Apr 1, 2019 at 7:18 | history | answered | user332375 | CC BY-SA 4.0 |