7 ms·
I’m currently trying to get into robotics. But why does everyone want c++? Surely robots can be programmed in other languages.
by mrfusion 6y ago
I’m currently trying to get into robotics. But why does everyone want c++? Surely robots can be programmed in other languages.
- _bxg1 6y agoA language is more than just a technology: it's an ecosystem of libraries, platform APIs, developer mindshare and experience, familiarity, legacy codebases, product support. Don't discount the weight of all of those auxiliary, human factors. Rust, culturally, comes from the web. That's why it has the most traction in the web server/WASM space for now. It's starting to poke its head into Systems use-cases because of the sheer weight of its memory safety benefits there. Maybe in a few years it'll get some real use in the games industry (real industry; not just enthusiasts), though Unreal remains a bastion of C++ that isn't going anywhere anytime soon. But then there are some dark corners of C/C++'s territory that move even more slowly, and where the cultural shift will take a long time. I think to a great extent, embedded falls into that category.
- timw4mail 6y agoNot really. While there is a growing set of web-based application for Rust, it's not like PHP, where the very purpose of the language is the web. Rust is a system language before it is a web language. WASM as a target is actually a great indication that it's a system language -- performance is a primary consideration.
- _bxg1 6y agoYou're missing the point. The point is that Rust came from Mozilla. Its mind-share started with web people and is expanding from there. What I'm trying to get across is that those social forces can matter more for adoption than just the tech's appropriateness, considered in a vacuum.
- setr 6y agoIn that case, it came from Mozilla for working on a web browser, with primary goals of security, building sandboxes & language runtimes (js), and replacing an application-level cross-platform C++ core. Which is very different than "web people", which in my mind implies webdev -- html/css/js + API server/db/caching backend. Which also further explains why WASM is so far along (sandbox, security), much better than any association with webdev itself; but not kernel-level system development. (But if the web browser is an userspace OS... then it's probably not that far from it)
- type0 6y agoOff course it's a system language, there are even some that try to build an OS in Rust https://www.redox-os.org/ https://www.redox-os.org/
- pjmlp 6y agoEveryone is targeting WASM nowadays.
- PopeDotNinja 6y agoProbably the same reason Python is big in scientific computing. A lot of stuff has already been written for it. If scientists needed to bootstrap scientific computing from scratch, Python wouldn’t be any more established than Rust, Java, PHP, or VB6.
- calaphos 6y agoAfaik pythons success in that field is relatively recent, only really taking of ~2010. The language was already 20 years old by then. Compare that to rusts first stable release in 2015. Building ecosystem just takes time.
- MacSystem 6y agoPython is easy to just start writing then the network effect made others use it
- flor1s 6y agoCheck out https://www.ros.org https://www.ros.org - it allows you to program in either C++ or Python (with some other languages being supported by the community)
- blub 6y agoBecause the real world doesn't really match the expectations and statements of the HN community. It's really rare that I see here anything pragmatic regarding what programming languages to learn/use. The community lives in a bubble and is out of touch with mainstream software development.
- mratsim 6y agoTechnically robotics isn't mainstream, Javascript/PHP/Java/C# are, at least in terms of developers. Now in terms of code deployed, C on the billions of embedded devices may be able to compete with servers?
- danielscrubs 6y agoI'd wager we actually have a lot of clever teenagers here at HN. Well-meaning, but has never worked in a team nor has any experience of what the market rewards.
- vardump 6y ago"pragmatic /praɡˈmatɪk/ adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations." I consider Rust more pragmatic at this point. Perhaps it's because I code in C++ as my dayjob and have to deal with the consequences. In theory, C++ is perfect given perfect developers. In practice, it's more sensible and realistic to write tricky, like multithreaded, code in Rust. One rarely mentioned important factor: fear. It's much less scary to modify something written in Rust than in C++. Doubly so for less experienced developers.
- Recurecur 6y agoI'm a very senior engineer. I've had a strong desire to find a better alternative to C++ since the 90s when I was first exposed to it (I worked with it for about a decade, after a few years with C). Now, decades later, enough bandaids have been applied that it's somewhat tolerable. Congratulations...? The industry has needed good alternatives for a long time. Finally, they're coming, and not nearly soon enough to suit me! :-)
- 6y ago
- calaphos 6y agoRust is very very new compared to Cpp. People have decades of experience with cpp, learned in in University. Why would you throw all of that overboard just to learn a fancy new language with a weird ownership system? Keep in mind that people often still write cpp98 and have a rely hard time getting used to newer cpp concepts and programming styles. And all of that is backwards compatible with their existing codebase.
- Aeolun 6y ago> Why would you throw all of that overboard Firstly, because 75% of all that knowledge is easily transferrable. Secondly, because you want to take 50% of your bug count.
- bjourne 6y agoBut why not program in Python and take 100% of your bug count?
- UncleMeat 6y agoIt is slow. It doesn’t work well for embedded programming. It very much does not fix all bugs, especially given lack of static type checking.
- zucker42 6y agoHe was saying this in the context of "why do people still use C++ at all".
- vmchale 6y ago> Why would you throw all of that overboard just to learn a fancy new language with a weird ownership system? lmao
- dpc_pw 6y agoIt will sound harsh, but people who can't up their game from C++98 to C++11, are probably not a people that I would consider hiring anyway. Generally, personally I would not hire anyone that knows just one programming language that they've learned in University and for years didn't manage to practice anything else, but that's just me. I actually worked in Automotive, and the software higher level up the stack there is usually god damn awful piece of s*, often done by people who have almost no clue what they are doing, with plenty of misconceptions about how C/C++ even really works (using `volatile` for concurrency/atomicity and stuff like that). They are just beating their spaghetti code from segfault to segfault for decades. This and slow delivery process easily explains why entertainment, navigation and other software-driven part of mainstream cars are so buggy, slow and generally terrible, and why Tesla could have so easily deliver way better experience. So it doesn't matter that some people can't "get into Rust". The business that hire them will be replaced if they can't up their game, that's all.
- Recurecur 6y ago> But why does everyone want c++? Few "want" C++, but for robotics a non garbage-collected language is necessary so latency is predictable. There are few mature languages besides C/C++ in that category. Rust is an improvement, but I'm hopeful something like Julia (Julia Robotics, https://juliarobotics.org/ https://juliarobotics.org/) or Scala Native (https://scala-native.readthedocs.io/en/v0.3.9-docs/ https://scala-native.readthedocs.io/en/v0.3.9-docs/) becomes mainstream, the productivity gains would be substantial.
- rozab 6y agoFor some reason Python seems to be very popular in academic robotics right now. Not a great choice
- WorldMaker 6y agoGarbage-collected languages can have (and some have had) latency-predictable GCs. It's not entirely an either/or, it's something of a false dichotomy. "Non-garbage collecting" languages blur the line anyway because even basic things like reference-counting are still a garbage collection technique. The trade-offs are in how many control knobs and where those knobs are/how you turn them, and a lot of developers still seem to feel much more "comfortable" manually writing all the knobs by hand than trusting a more algorithmic GC's shiny chrome knobs on the outside of (what they presume to be) a black box. But perceived "comfort" isn't entirely reality. (The comfort of smart GC languages is immense in a different way.)
- Recurecur 6y ago
- DarmokJalad1701 6y agoAs a datapoint/anecdote, I work in an autonomous vehicle company and we have adopted Rust extensively in our codebase in the last six months or so. Previously, the code base was primarily Python with some C++. Now there is a significant chunk of code, particularly related to safety, written in Rust.
- MacSystem 6y agoThat's interesting. But did your company consider using D? if so, why did chose Rust?
- jki275 6y agoThe problem is that whIle C++ has problems, all languages have problems and C++ has the most going for it in terms of being fast and easy to write. C++11 is a really good language. Also there are tons of libraries and things people have already built in it that you can leverage to reduce development time.