Jay Taylor's notes
back to listing indexWhich language has the brightest future in replacement of C between D, Go and Rust? And Why? • /r/rust
[web search]~48 users here now
The Rust Programming Language
A place for all things related to the Rust programming language, an open-source systems programming language that emphasizes zero-overhead memory safety, fearless concurrency, and blazing speed.
Rules
+ Respect our Code of Conduct.
- We strive to treat others with respect, patience, kindness, and empathy.
+ Constructive comments only.
- Criticism is encouraged, but ensure that your criticism is constructive and actionable. Throwaway comments are just noise.
+ No memes.
- Leave the image macros at home. This applies to comments, as well as top level posts.
+ No zealotry.
- When discussing other programming languages, maintain civility and respectfulness.
+ Chill out!
- A programming language is a pretty silly thing to get upset over.
+ Quadruple Parallel Universes?
Resources
+ Learn
- See the language FAQ and project FAQ.
- Read the book.
- Skim the release notes.
+ Install
- Grab the binary installers.
- Build from source.
+ Discuss
Visit the official forums for users and the official forums for developers, or chat on IRC (irc.mozilla.org):
- #rust (general questions)
- #rust-internals (compiler dev)
- #cargo (the package manager)
- #servo (web browser dev)
- #rust-gamedev (vidja games)
- #rust-osdev (operating systems)
- #rust-webdev (web all the things)
+ Contribute
- Get the source code on Github.
- Report bugs in the bug tracker.
MODERATORS
- azth
- kibwen
- dbaupprust
- flaper87rust
- hailmattyhall
- mrmondaylibpnet · rust
- howellnickrust
- wrongerontheinternet
- Manishearthrust · servo · clippy
- sho_kde
- ...and 1 more »
Which language has the brightest future in replacement of C between D, Go and Rust? And Why? (quora.com)
[–]loamfarer 39 points 3 months ago
This was an enjoyable read and I always enjoy Andrei's candor. I think I gleaned more knowledge on D here than the others, but that was to be expected.
I really see Go as being out of this race. It seems to encroach more on Ruby, Python and Java than the system languages. But even then it's not my cup of tea. Do people no longer talk about Nim? I feel it's prospects are much greater in this realm. It seems to be coming along nicely and their resources seem to be well put together. Nim certainly has some advantages of compiling to C.
The prospects of D giving you powerful zero cost abstractions, and powerful generics whilst at the time offering first class C ffi and capable as serving as a scripting languages where memory management is shoved out of sight! That is a tantalizing pitch. I feel I have a much less clear insight into the community and learning resources than rust, which has been a huge help in getting me in the door. This might just be me not looking hard enough. At any case I'd like to give it a try.
As for Rust, I've chosen to pick it up really because I've enjoyed C more than any other language. But dread debugging aliasing, use after free, and other race conditions. I really do like to think about memory management, and I really do want to be babysat by the compiler. My favorite thing about Rust though is its type system. For whatever reason I dread the C++ and Java style OO. Templates, interfaces, inheritance. Then composing all that. Ugh. Rust to me actually feels more like giving C an ML-like type system than anything. The nice thing about Rust right now, is that it's getting some serious industry upswing, with success. I know a lot of people want generics and higher kinded types. Hopefully those hit at some point. Even with perhaps the lengthy development cycles of rust. The final results of both safety and concurrency are justifying the upfront budget. The thing I always find myself wondering about the future of rust in being used in real-time infrastructure systems, or massive scientific institutions like Nasa and Cern and other areas of precision research. Both for fault free controllers, or for accurate simulations.
[–]steveklabnik1rust 14 points 3 months ago
I know a lot of people want generics
We do have generics, did you mean integer-level generics, maybe?
[–]iopqfizzbuzz 17 points 3 months ago
We want generic generics so you can code generics while you code generics.
[–]Sinistersnarerust 16 points 3 months ago
So Higher Kinded Polymorphism?
[–]iopqfizzbuzz 13 points 3 months ago
Yes, I'm still waiting for Rust to be able to express Monad
in a satisfactory way. Then maybe we can even have do
notation so people like me can stop whining about how Rust is so verbose in its error handling.
[–]Ruud-v-Arust 4 points 3 months ago
Perhaps one of the reasons that Rust is so verbose (I don’t share that opinion though) is that Rust forces you to do error handling at all.
[–]saposcat 2 points 3 months ago
Absolutely not. The jury is still out on whether monads are the right abstraction. See: Algebraic Effects and Handlers, and compare those to monad transformers. I think adding another trait to the compiler's list of traits it knows about is a bad idea.
Also, I think with respect to monads, there might be a potential for novel ways of compiling monadic computation because in Haskell, monads are usually encoded as value transformations, whereas in Rust we have a region tracking system that might be extendable to things other than lifetimes. In C it is common to chain computations but check error flags before continuing. In Haskell you pass optional types. What if you could write the Haskell version but it compiled to the C version?
[–]iopqfizzbuzz 1 point 3 months ago
Monad
should be added as normal higher kinded trait, not specially encoded into the compiler.
[–]SteveMcQwark 1 point 3 months ago
Higher-ranked polymorphism is about more than just monads. A concrete example of something I'd like to see that it would enable is generic owning references. What that means is to be able to encapsulate the ownership a value inside an object which provides access to an arbitrary borrow into it. So an owning reference could own a vector and provide access to an arbitrary slice of it, or to a reference to an arbitrary element of it. You could then move the owning reference around just like a vector and know that the slice it provides access to remains valid.
The challenge with doing this is that you don't want to be limited to a particular type of reference. The owning reference library is artificially limited because it requires you to use shared references (i.e. &T
) for the reference part of the owning reference, which rules out interesting patterns like using mutex or RefCell
guards, for example, or even &mut
references.
[–]staticassert 0 points 3 months ago
There's a crate for that.
Mobile so I can't find it for you right now.
[–]steveklabnik1rust 6 points 3 months ago
uses duck typing though
[–]mekanikal_keyboard 19 points 3 months ago
Go is definitely "out of the race" to replace C....but it is definitely in the race to replace Java and easily has 10x the number of active coders and job prospects as the rest of the tools Andreri discusses.
[–]Manishearthrust · servo · clippy 8 points 3 months ago
Also Python, really. One of Go's main selling points, the simplicity and ease of use (low start up time, etc) is shared with Python and Go arguably does that better. Python has a lot of other features which keep it going (which Go doesn't have), so Go probably won't replace Python, but it may get some of the mindshare.
In fact, when I look at Go, I think less "Java" and more "Python"/"Ruby"
[–]loamfarer 0 points 3 months ago*
I will say, PyPy is looking really neat. I think it in conjunction with a general shift towards Python 3 (finally!) will keep python in the running for quite some time to come. Additionally we have Julia, which maintains interoperability with both Python and C/C++ world. Of course that means D/Rust come along for the ride too.
I don't see Go taking away all of Python's domain. More than anything I see it moving on Ruby and backend web Java domains. Of course Java is leaking to Scala as well. Application Java is already losing to open C# via mono. So I think Go has a lot of opportunity to pick up some of the market that Java loses.
[–]Manishearthrust · servo · clippy 4 points 3 months ago
Additionally we have Julia, which maintains interoperability with both Python and C/C++ world.
what what WHAT WHAT WHAT
Why haven't I heard about this?
I'm a Mathematica/Python/Rust person for scicomp, but now I've got to try Julia.
I don't see Go taking away all of Python's domain
Not all, but most.
I consider Ruby and Python to be in similar spaces, really :)
[–]steveklabnik1rust 5 points 3 months ago
Julia is really great, you should check it out for sure. Graydon wrote a blog post about it http://graydon2.dreamwidth.org/189377.html
[–]pjmlp 9 points 3 months ago
First is has to offer generics, a proper debugger (not one that rewrites text), REPL, battle proven SQL DB drivers, monitoring tools like VisualVM and Mission Control, IoT like support, ...
[–]silent-hippo 10 points 3 months ago
The only way Go has any chance to replace Java is if Oracle pulls some stupid greedy move that chases off Java devs. Right now Java is a more powerful language (more features), as fast or faster than Go, has better tooling, and has 10x the already trained devs who will be annoyed by a lack of generics.
[–]lapingvino 9 points 3 months ago
That's one of the few things you can trust Oracle on though, they did that already about OpenOffice/LibreOffice.
[–]silent-hippo 6 points 3 months ago
I certainly don't put it outside the realm of possibility that Oracle destroys Java :). I was a Java fanboy until that deal went down and then I decided it probably wasn't worthwhile to swear my loyalty to a language because who knows what's going to happen to it.
[–]llogiqclippy · rust 4 points 3 months ago
We all know how this turned out. OpenOffice is now an Apache project and LibreOffice 5.0 is just great. If that's the future to befall Java, as a Java developer I welcome any greedy move by Oracle. Cannot wait to get my hands on LibreJava 10.0 :-D
[–]lapingvino 3 points 3 months ago
The problem is though that they stick to their trademark on this one, so it won't be called Java. As Google uses Java for Android, either way we would be hearing from Google in this case, either with better Go support for Android or better support for OpenJDK etc...
[–]fgilcherrust-community 9 points 3 months ago
Do people no longer talk about Nim? I feel it's prospects are much greater in this realm. It seems to be coming along nicely and their resources seem to be well put together. Nim certainly has some advantages of compiling to C.
I can tell you that: Nim is bad at getting the word out. Technology doesn't win by being better, it wins by being explained to be better. And you need a lot of people that do not get bored of doing that a thousand times, at a really simple level.
[–]MrJohz[🍰] 1 point 3 months ago
Look at it another way: Rust is backed by Mozilla, and D for a long time had an association with Facebook. Nim doesn't have any big names behind it, and in many ways is still Araq's personal project.
I like Nim, but it needs a backer or big name behind it if it's going to have any chance at succeeding, at least now the market is so saturated.
[–]Manishearthrust · servo · clippy 7 points 3 months ago
I think another part of this is that the Rust community managed to attract respected people from other, non-C++ fields. Steve from Ruby, Armin/Georg from Python (pocoo), and lots of other known community members. This leads to Rust being mentioned at their conferences, or even being the subject of whole talks. And, of course, blog posts and tweets. Creates a wider community, and a wider net gets cast. I don't think the effect of having these people around has been appreciated enough :)
Go has some of this, but not as much. D and Nim don't seem to have this at all (could be just me not knowing about it, though).
[–]meteorMatador 1 point 3 months ago
To my knowledge, that's exactly the role Andrei Alexandrescu (ie. the author of OP's link) plays in the D community, having been persuaded to renounce C++.
[–]fgilcherrust-community 10 points 3 months ago
I consciously did not choose that way, because it is dismissive to those people that actually grow the language community. This is rarely done by corporations. It helps as a start, but this is it. I know at least as many cases where company affiliation is actually a hindrance to community growing.
Many of the community projects this year happened without Mozilla support and Mozilla is also not set up for managing Rust in the way it manages Firefox. Grassroots movements are much more agile and quick. I want to run OpenCodeTown? I just do. Mozilla will take at least half a year of ramp-up until they decided whether they will a) push Rust, b) on that event.
You don't need big names. Ruby, Python and Perl made it without. God, was Ruby in a shitty state when people picked it up. You can grow your own big names.
Failure to attract people that want to do that work and are glad to do that is a defect in the language ecosystem that cannot be fixed by cash pools.
There are a few important languages that gained traction without a big name behind them - I'm thinking of PHP, Perl, and Python. I wonder if it's significant that these are generally (?) viewed as scripting or glue languages rather than application languages?
[–]desiringmachines 21 points 3 months ago
This was a great post for revealing my biases to me, because I read through the D and Go sections thinking it was really insightful, informative, and on point, and then I got to the criticisms of Rust and recoiled.
[–]Manishearthrust · servo · clippy 35 points 3 months ago
While I respect Andrei's opinion a lot, he's evoked the image of a "large borrow checker muscle" in Rust multiple times. I think that's not really an accurate description.
I find that the borrow checker, while one of the most advertised parts of Rust, is not the one place Rust spends all its design budget. Certainly the one place Rust does something almost completely new (instead of mixing up random language features from other languages), but D and Go don't have any of that so that's not really on the table anyway. And, in fact, parts of the safety architecture (affine types) is as useful for unrelated things as it is for memory safety. Affine types let you think about data in a very intuitive way. Something I miss tons in C++. But memory safety aside, Rust has plenty of awesome features (exhaustive-matched enums! awesome closures! cool iterators! zero-cost abstractions! tools to build your own! monadic errors! post-parser macros! traits!) which are key features in the language over others (though these have all been borrowed from other languages).
[–]staticassert 19 points 3 months ago
Agree entirely. The borrow checker is something that keeps my code clean, and I love it, but it's invisible to me at this point. What really keeps the language so interesting for me, and what makes me enjoy writing it so much, goes far beyond the borrow checker (though the existence of the borrow checker is sometimes what allows for the cool features).
[–]flying-sheep 7 points 3 months ago
The ownership model also helps with concurrency right?
[–]Manishearthrust · servo · clippy 4 points 3 months ago
I sort of stuffed that into "borrow checker" to give Andrei the benefit of doubt that he was talking about "safety" (not just borrowck). But yeah, if you consider that separate, sure.
[–]burntsushirust 28 points 3 months ago
The realities of 1.0 ended that honeymoon and marked (by my measurements and estimates) a stark decrease in general interest
Anyone else feel that way? If anything, seems like the opposite to me! Of course, I may be a touch biased...
[–]annodominirust 42 points 3 months ago
Well, I think that the 1.0 hype bubble was a real thing.
For those of us that have been following rust both before and after the 1.0 hype bubble, there's definitely been a marked uptick in interest, in size and quality of the Rust ecosystem, and so on, compared to, say, a year ago.
But the hype bubble was a real thing, so for people on the outside, who may have heard most about Rust during that time, it might appear that interest has dropped off sharply since then.
So, I think that in the long term, Rust is doing great at getting out the word, attracting new contributors, and building up an ecosystem. And the post-1.0 stability (libc issues aside) has been a big boon to that. But in the short-term, if you look at peak hype to now, it looks like everyone stopped being interested in Rust after 1.0 was released.
[–]jfagerrust 8 points 3 months ago
Part of the excitement of Rust pre-1.0 came from the willingness to relentlessly iterate on design decisions to find what worked. There were a lot of frustrations that came along w/ that, and it was a huge barrier to general adoption, but there was an energy to the project unlike any other that I've followed.
That specific energy has dissipated a bit, and I think the energy that comes from a large community actually building lots of cool things hasn't quite arrived yet. Don't get me wrong, there are definitely very cool projects being written in Rust. But its not yet the cambrian explosion you see over in go-land.
The work being put into Rust and the ecosystem right now is the work that bridges the gap - faster compiler, better tools, foundational libraries, headliner projects (servo, redox), documentation - but it's not as exciting to the casual observer as what came before and what's going to come later.
[–]steveklabnik1rust 11 points 3 months ago
I think there's a lot of people who just also aren't talking, they're shipping. It seems like every other day I hear about another company using Rust in some small capacity, but they're just not publicizing it yet.
For example, I know of a really important consultancy company that uses Rust to deploy their main website, they just haven't talked about it at all yet.
[–]jfagerrust 2 points 3 months ago*
Sure, that's really what I was trying to say. The next booster rocket fires off once these companies start publicizing/hiring or we see releases of open source projects that a bunch of people start using.
Same thing happened w/ Go - an initial rush of excitement that Google was doing a language, a period of time where the chattering classes wondered if anything was going to come of it while a bunch of real work got done in the background, then suddenly everyone seemed to be using it and we got Docker, Influx, Kubernetes, Prometheus, Cockroach, etcd, consul, etc, etc.
[–]burntsushirust 3 points 3 months ago
I just haven't observed a "stark decrease in general interest." That's all i was disagreeing with.
[–]sanxiynrust · servo 4 points 3 months ago
I think post-1.0 "decrease in increase of general interest" compared to pre-1.0 is real. On the other hand, I agree that it is best described as "slowdown", not "decrease".
[–]jfagerrust 1 point 3 months ago
I'm thinking of 'general interest' as meaning HN or proggit discussion, and that does seem to have dropped off quite a bit from 1.0 peaks. But I completely agree there's more actual adoption, more code being written, more libraries coming on line or companies starting to use it, etc. The latter is more important, and the former will go back up once that work becomes more prominent.
[–]Manishearthrust · servo · clippy 9 points 3 months ago
It might just be because I'm a part of the community team and got to hear Real World Rust stories from people a few months after that, but it felt like the opposite. There was definite 1.0 hype in that month, but not some drawn out honeymoon.
[–]hotdaaaamn 5 points 3 months ago
You and I are on IRC a lot of the time and one thing I've noticed here is every day we're seeing a brand new complete projects or rfc's for crates with more and more complex functionality right away. I think we're on the edge of a major boost in numbers as some of the basic tooling comes together. Developers love tools, I feel like things have increased in pace as far as productivity goes. When comparing systems level languages I'd say with extreme bias that we've got the most hype and the most potential to be future proofed. The communities questions have moved from what is lifetimes to implementation concepts in ~6months, we've got a solid tool and the support for newcomers is growing exponentially.
[–]ethelward 9 points 3 months ago
The opposite for me, 1.0 was the moment I began to really use Rust on serious projects.
[–]robertmeta 2 points 3 months ago
Anyone else feel that way? If anything, seems like the opposite to me! Of course, I may be a touch biased...
All of this is my personal experience, yada, yada.
From a community perspective, I felt a small drop-off in energy / excitement, but not too much. Basically, people who hoped Rust would be a magic bullet at 1.0 tried it and said "guess not" and moved on, but this was more than offset by new libraries and tools being built on 1.x.
From a professional perspective, there was a tremendous drop in interest (to basically zero). Haven't had a single discussion with a client about Rust since the 1.0 release -- I had LOTS of discussions about it prior (prepping for 1.0). I think 1.0 didn't deliver on (unrealistic) expectations for lots of shops and has fallen off their radar entirely. Now I mostly get questions about if people should be investing in Elixir and/or Swift as the "next thing". Go has already reached a point of boring acceptance in a lot of shops, like JS, Java and Python.
[–]TheHillwoodMonkey 5 points 3 months ago
The opposite for me too, because my issues were lack of tooling, libraries and stability. From that perspective, the period following 1.0 has been the most exciting time.
[–]fgilcherrust-community 0 points 3 months ago
(also being part of the Rust core team)
Well, there was a 1.0 hype certainly, but I don't think it has turned Rust into anything less of a "community darling". We managed one thing well: selling 1.0 as a "playtime is over, you can now seriously use this" event. A lot of people took it as a point to pick up Rust and to really consider it.
I really like the text, but one thing I'm missing from him is a clear grasp of social dynamics. While I like his nod towards "PR", and some waving at "solid marketing", he's missing a crucial point: of all those communities, we do have a formal and effective structure for that!
[–]Manishearthrust · servo · clippy 3 points 3 months ago
(s/core/community, core team is different) :)
[–]hotdaaaamn 15 points 3 months ago*
10x better safety than other systems programming languages. Of course that had to be here, we just discussed the cost of that.
I think for future proofing systems when codebases get to be 19million odd lines long more than makes up the cost for this, and is why I think Rust is/soon will be the main player when it comes to replacing low level C code. What a great read.
10x better than any other system language at generic and generative programming. D's static introspection, compile-time evaluation, and mixin-driven code generation combine to a powerful cocktail that is very difficult to mix right in other languages
Cool, I want to hear more about that.
[–]Manishearthrust · servo · clippy 10 points 3 months ago
I've heard a lot of awesome stuff about D's metaprogramming. I haven't yet looked deeply into it, but the precursory looks I've given it in the past have been promising. You should read about it.
[–]jeremiahs_bullfrog 11 points 3 months ago
I built a JSON parser that used static reflection to generate a parsing function that efficiently constructed a class object and populated it with values from the JSON. All this took a few hours and I ended up with a very fast JSON parser.
D's templates coupled with CTFE and static reflection are revolutionary. I came from Go with runtime reflection and found that I really didn't miss anything, and the end result was much faster.
I would really like to see Rust go more this direction (I know it has some support ala the serialization library), but it has a ways to go before it rivals D's expressiveness and powerful simplicity (someone even made a ray tracer with CTFE!).
[–]Manishearthrust · servo · clippy 5 points 3 months ago
FWIW Rust can do everything D can do at compile time in a plugin, just that plugins aren't ergonomic.
(That's how the serialization libs work, for example)
[–]jeremiahs_bullfrog 7 points 3 months ago
My point was that I just stepped into D and built something fast, and it was fun. I'm still wrapping my head around compiler plugins in Rust, but it's just not the same experience.
Go doesn't have this at all, so you have to do runtime reflection.
[–]Manishearthrust · servo · clippy 10 points 3 months ago
I know, and I agree, D's system is awesome and useful :)
Just leaving a side note.
[–]bjzabarust · cgmath · gl-rs 4 points 3 months ago
Rust can do everything D can do at compile time in a plugin
You don't have access to types though, which makes things less ergonomic - no need to constantly pass around the types. And D's metaprogramming feels like working in the same language - syntax extensions fell like working in a poorer sub-language.
I love D's metaprogramming, and feel like lots of Rust folks could learn something from its ergonomics. It's not something that would get me to switch back though, but it is certainly something that Rust lags behind on.
[–]bjzabarust · cgmath · gl-rs 3 points 3 months ago
D's templates do similar code generation, but you have access to the types as well.
[–]krappie 17 points 3 months ago
When it comes to replacing C, garbage collection seems to be the major dividing factor. Sometimes garbage collection just isn't appropriate for the low level high performance problems you want to solve. Go and D are out. Rust seems to be the only new language that has the ability to replace C.
[–]MrMarthog 19 points 3 months ago
D 's problem is the library. The core language was developed in a way that combines the speed and determinism of RAII with the ergonomic usage of a garbage collector. It was designed to do everything that is possible with C++.
Unfortunately the standard library was developed unter the asumption that there is always a garbage collector, making it a de facto gc'ed language. If D had a library similar to C++'s or rust's, it would be an adequate replacement.