2 ms·
Genereally speaking async is one of those things that the JS community hasn't quite figured out yet. (Nor has anyone else, really.) Personally, what I'd really
by lomnakkus 13y ago
Genereally speaking async is one of those things that the JS community hasn't quite figured out yet. (Nor has anyone else, really.)
Personally, what I'd really like to see is an M:1 thread model, i.e. a model where you program as if you have M threads of control, but only one of them is actually executing at any one time. Any calls which are currently async would behave as if blocking and would yield control to any other runnable "thread". So you would have concurrency but not parallelism -- which is effectively what you have to reason about anyway when you have async.
It may very well just be me, but I find that reasoning about normal "blocking" flow control is vastly easier in general than reasoning about async flow control even if it involves multiple threads. It gets even easier if you limit all inter-thread communication to some form of queueing/message passing.
EDIT: Reading it back this looks overly convoluted, basically what I'd like in JS is "user-space threads".