7 ms·
One reason JS makes sense (in; for example, robotics): For all of JS’ problems, it handles async wonderfully. I can think of plenty of actions in robotics that
by Townley 6y ago
One reason JS makes sense (in; for example, robotics): For all of JS’ problems, it handles async wonderfully. I can think of plenty of actions in robotics that boil down to “do these 3 things concurrently and then do thing #4 when they all complete” and Promise.all or async/await are helpful constructs to have when designing those instructions. It won’t be as performant, but the developer won’t have to worry about polling or communicating across threads/processes
That’s not a knock against assembly, or to say that the same can’t be done in C with time and skill. But in many cases, compromising performance for developer efficiency is a good call.
- naikrovek 6y agoIf concurrency were so hard that switching away from some decent language to JAVASCRIPT seemed like a good idea, I would agree, but it isn't that hard. Not even close. Threads are a very well understood concept.
- fn1 6y agoIt's just that JavaScript has no threads, which is it's problem.
- soylentgraham 6y agoAnd nor do most microcontrollers, so perfect fit!
- petra 6y agoasync has another benefit: the mcu can sleep while the program is waiting, which offers an easy way to write low-power systems.
- mhh__ 6y agoWhy not just use C++ and not sacrifice any performance at all? You say async so it might not be applicable, but C++ has a standard memory model you can rely on for consistency.
- bananaface 6y agoWhy can't you just replicate these features in C? Surely await/promise libraries exist?