13 ms·
Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up, when I'm so h
by dpc_pw 6y ago
Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up, when I'm so happy with Rust, and ecosystem is growing so fast. Maybe D got much better in last few years... but I kind of don't care anymore. It's hard enough to introduce a raising star like Rust to your coworkers and D just don't have traction anymore.
I've been following D since early 2000s. 2 decades. It took it a long time to get good: make it open source, make it community driven instead of one-man show, add some really important features and focus on important things (ownership, memory-safety), get the tools to be good.
It just missed the boat, and never really had a right niche for itself. It was kind Java/C++ mix, and it wasn't all that better to dethrone anyone in that space.
Rust swooped in and executed everything perfectly in a really short time. It's a C++-killer: same strengths, none of the weaknesses. Normal people don't want to touch C++ anymore. Only people that think that CVEs are "just fault of bad developers" (LOL) can still be considering C++ a good language to start new projects in. Industry really, really needed C-like language that was memory safe, and all-round good: both low and high level. And Rust quickly delivered that, borrowing all the great aspects of other languages and addressing a lot of problems.
D is great, and I like it far more than e.g. Go, but it was an ambitious project by one individual for a long time, while Go had a whole Google behind it. There's no shame that it didn't "took over the world". Rust would possibly not do so well if it wasn't for Mozilla support. The marketing, credibility and traction a big backing company like this gives a new language is probably the single bigger reason for different outcomes.
- mrfusion 6y agoI’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.
- ncmncm 6y ago> Normal people don't want to touch C++ anymore. Only people that think that CVEs are "just fault of bad developers" (LOL) can still be considering C++ a good language to start new projects in. Deliberately inflammatory, and also false. 1. Rust has limited abstraction features to make it more approachable and implementable, but make it unable to express libraries that are easy in C++. This will not change soon, although Rust will accrete features at a steady rate. But the gap in feature sets will widen, not narrow with time. 2. The total number of people using Rust in production is easily less than the number who pick up C++ in any given week. It will be ten years before Rust is a mature industrial language, if it gets there. (It has made a good start in that direction, which is better than can be said for any other newish language.) 3. C++ and Rust will coexist for decades. The most ambitious work will continue to be done in C++, while Rust will be more than adequate for what might otherwise have been done in (the much less capable) C, Go, or Java. 4. D fizzled because it is too similar to C++, and therefore unnecessary. Rust found a ready audience in people intimidated by C++, frustrated with the limitations of C, Java, and Go, and ready to try something wholly new. Its designers have threaded the gap deftly, uniquely adopting C++'s greatest strength, the destructor (which it calls the "Drop trait"), and avoided weighing it down with garbage-collection. It has a bright future if it can multiply its adoption rate by two orders of magnitude. As Stroustrup said, there are only two kinds of language: the ones people complain about, and the ones nobody uses. With enough luck, by the time Rust is mature, it will have gained plenty to complain about. Rust will have got somewhere when you read more complaints about it than brags about having made it do something already done in a mature language.
- tutfbhuf 6y ago> 3. C++ and Rust will coexist for decades. Nah, I mean maybe in the way that Fortran coexist with C/C++ for decades, but it's not equal coexistence. I would rather say that new languages arise, replaces old ones for most scenarios and in the cases where they can't, due to various reasons, they push the old language into zombie state like cobol.
- nix23 6y agoYou don't replace languages but program's, go into physic-space, fortran is alive an well, go into systems programming c is alive an well, go into business java is alive and well. It's the same BS like NoSql will kill all R-D's. You just don't invest millions just to rewrite programs that work's perfectly (and that's often the case with old battle-hardened software)
- frozenport 6y agoC++ for its libraries
- danielscrubs 6y agoAre you saying AAA-game/kernel/embedded developers are not normal? Pretty uncalled for if you ask me.
- dpc_pw 6y agoDepends on how you define normal. :D I offended a lot of C++ fans, I guess. I guess what I meant is "vast-majority of devs out there". I did ~10 years of kernel/embedded myself. Generally people use C++ only when they really have to (like: they work in one of this niches, or want to get a job there). I've experienced myself many times when people would go with anything but C++ because of all it's faults, weaknesses and general infamy. And I also have seen some people that gave Rust a try and it went smoothly. They deliver a proper C++-level performance and resource control, without any of the problems and were happy about the experience. AAA-game/kernel/embedded are all lucrative (except games, lol), important and not tiny but they are still niche.
- MacSystem 6y agoHow aren't games so lucrative? did you any of your guys did try D before rust?
- tluyben2 6y ago> It's a C++-killer: same strengths, none of the weaknesses Not used Rust yet, used a lot of C++; isn't a weakness that it also is extremely slow in compiling? Not sure about others but to me that's a big weakness (if it still applies, but as far as I can find on Google it does).
- Kaze404 6y agoFrom my experience building (not writing) relatively complex Rust applications like Alacritty, it's really not that bad. Building for release is definitely slower than C++, but development builds are almost always instant for me, as they're done incrementally.
- adamnemecek 6y agoRust is much better at caching the intermediate results of compilation. First time compilation might take some time, recompilation will be faster though.
- sivizius 6y agoMost of the time, I let my IDE check the code with rls, rust-analyzer or cargo check which invokes the rust-compiler without doing the costly code generation part with LLVM, so it is usually fast enough checking huge projects while writing or at least when saving.
- vmchale 6y agocargo doesn't do a terribly good job of caching dependencies. Might be better than whatever C++ does though.
- pjmlp 6y agoCurrently C++ is still a better experience, because using binary dependencies is quite common, so you don't compile the whole world, rather just your own application. Then most organizations have staging areas where you can share binaries across the company. And the two package managers that have been growing community support, conan and vcpkg, support caching and distribution of binary dependencies. No doubt cargo will eventually get something similar, it just isn't there today.
- billconan 6y agoI got scared away by rust's syntax. I feel that people can learn rust faster if they know c++ beforehand. c++'s syntax is scary too. But there are different levels of c++. You don't need to use the scary part to make things work.
- cyberprunes 6y agoDisagree. Sure rust has a notable syntax tax (not what it used to be) but that's the easy part! It's the concepts and mindset that are the biggest hurdle in Rust. Going to C++ first won't help you there. If you already know it, great but Rust is a different language and you'll spend a lot time trying to transfer C++isms over until you realize writing effective Rust is not like writing effective C++ and you go through a process of unlearning. In my view, learning C++ for the purpose of learning Rust is massive waste of time.
- peterkos 6y ago> Rust is a different language and you'll spend a lot time trying to transfer C++isms over until you realize writing effective Rust is not like writing effective C++ and you go through a process of unlearning Ding ding ding! However I do think that the combination of syntax with the brand new concepts just adds that extra layer of complexity. A similar thing is Optionals in Swift -- the syntax is so baked into the language that even if you really understand how optionals work, the syntactic sugar keeps piling up in different situations. (i.e., first the ? operator, then implicitly unwrapped optionals, then if lets, guards, guard lets...)
- kd5bjo 6y ago> I got scared away by rust’s syntax. I’m curious about what you find scary about Rust’s syntax. I always found it to be a fairly natural extension of the syntax from C and other ALGOL-derived languages. Its semantics, on the other hand, took quite a while to wrap my head around. I am reasonably productive in Rust these days, and I still sometimes can’t predict whether or not the compiler will allow something.
- 6y ago
- westicecoast32 6y agoReally? I find that rust is worse than C++ thanks to clang For example, is there a way in rust to get a runtime error when there's an int overflow?
- zucker42 6y agoYes there is. Overflow panics by default in debug mode, and you can turn that in in release mode with the overflow-checks compiler option. There's also checked_add.
- zRedShift 6y agoOf course. rustc has the "-C overflow-checks" flag. Cargo turns it on by default for debug builds. To turn it on for release builds, just put "overflow-checks = true" in the [profile.release] section of your Cargo.toml. Or better yet, the Rust standard library exposes all the relevant LLVM intrinsics for the primitives, so you have the {Integer}::checked_, {Integer}::saturating_, {Integer}::wrapping_, {Integer}::overflowing_ (inlined) functions to do all your integer math in an error-free fashion.
- vmchale 6y ago> Industry really, really needed C-like language that was memory safe, and all-round good: both low and high level. And Rust quickly delivered that Well, almost. I'm not sure I like unsafe FFI and other bits. > Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up Yup. Better to use Rust if it's the one introducing the features.
- bigjake 6y agoSupport for unsafe constructs is almost critical to a languages success. There are certain things that just cannot be done safely, and any language that wants to be considered a systems language needs some method of providing that functionality. Usually native unsafe support is the cleanest way to go.
- peterkos 6y ago> Rust would possibly not do so well if it wasn't for Mozilla support. And especially Mozilla's intense passion for open-sourcing everything. I think it was a good catalyst to get it into the hands of as many people as possible.
- pjmlp 6y ago> Industry really, really needed C-like language that was memory safe, and all-round good: both low and high level. And Rust quickly delivered that, borrowing all the great aspects of other languages and addressing a lot of problems. Industry has had Ada since 1983, Modula-2 since 1980, Object Pascal since 1990, and a couple of other ones, not counting all those Algol and PL/I variants that precede C for about 10 years. Unfortunely the industry will only take security seriouly when security exploits are severly punishable by law.
- bigjake 6y agoNormal people? Exactly what is a normal person there, Einstein.