5 ms·
As much as I love JavaScript, I have always preference synchronous languages (like, say, Python) for robotics programming.
by nullbyte 8y ago
As much as I love JavaScript, I have always preference synchronous languages (like, say, Python) for robotics programming.
- newfocogi 8y agoIn what way is Python any more of a synchronous langues than JavaScript?
- netinstructions 8y agoThe next line of code in JavaScript isn't always going to be executed after the previous line is complete. This is unlike Python, which generally executes each line after the previous line is complete. Hence all the callbacks, promises, async/awaits patterns to learn in JavaScript..
- hartbeatnt 8y agoasync/await is pretty easy to use... plus if you want your robot to be able to perform multiple actions at once (i.e. rotate a camera to stay focused on an object while moving) having asynchronous capabilities seems like it would make things easier. That being said I have zero robotics experience, just a lot of JS experience lol :shrug:
- bsimpson 8y agoThis feels intellectually dishonest. The next line in JS is guaranteed to execute immediately after the preceding one; except in the case of callbacks (including sugar, like promises), which are also executed sequentially, but deferred until they are explicitly called by whatever they're passed to. In fact, one of the biggest complaints about JavaScript (that it can block the main thread if it tries to do too much in one frame) is a consequence of this guarantee. Granted, I've written primarily JavaScript for the last five years, but it's pretty straightforward to reason about. Any language that lets you respond to events, I/O, etc. is going to require that you reason about things over time - JavaScript is no outlier here. The way you've written your remark, it sounds as if JavaScript executes lines out of order, or will wait an arbitrary amount of time to move from one line to the next. Obviously, neither of those is true.
- digitaLandscape 8y agoYou have things backwards. Python has threading, JavaScript does not. Potential breaks in execution are limited and explicit in JavaScript but almost ubiquitous in Python.
- Moghammed 8y agoI really love javascript for programming behaviour in robotics. That's so much more intuitive to do in an event based language.