Rust 2018 survey results
blog.rust-lang.org
blog.rust-lang.org
Is the "The survey also highlights some challenges, as the number of women is still lower than the industry average of women in programming fields" editorial comment based solely on this result? It seems to exclude the possibility of women who don't identify as belonging to an underrepresented group.
Or is it: "Yes I'm a woman, but I don't feel underrepresented"?
The percentages can add up to >100% because you can be part of multiple groups, e.g. a gay woman.
2. I get that, I'm just surprised it's so pronounced. With most statistical distributions, when 0 (flavours of underrepresentation) covers 92% of responses, you'd expect 1 to cover a major chunk of the remainder, and that doesn't appear to be the case here.
I think averages shouldn't be goals by themselves. And there's no good reason on why should Rust approach this Hypothetical Average, since Rust Lang != Hypothetical Average Lang.
I mean that I guess being closer to this hyp. avg. doesn't make it "better", whatever that means..
Absolutely. If I had taken this survey, I wouldn't have checked "I feel underrepresented because I'm gay" because... well, it's literally never been an issue. In that sense, why would I care if I'm the only gay guy in a team of a million programmers? They all treat me just fine. Must I be "represented"?
I can imagine the numbers, for that reason, simply won't reflect the number of non-heterosexual people. It could be higher.
So a decrease in the "underrepresented" statistics doesn't necessarily mean it's dealing with the actual situation.. It wouldn't necessarily imply anything "bad" or "undesired".
> women who don't identify as belonging to an underrepresented group
The existence of significant numbers of such people seems to be the object of much speculation on HN, possibly because it would undermine attempts to increase the representation of women. However, I have not seen evidence that such a population exists. Also, underrepresentation in this case is much more a matter of math and not one of chosen identity.
I'd consider a small data processing service, maybe a service invoked from the web server you're already using in Ruby or whatever, is a perfectly pleasant place to use Rust, and often likely to be 1:1 identical to those other languages.
enum Value { Null, Bool(bool), Number(Number), String(String), Array(Vec<Value>), Object(Map<String, Value>), }
How would this look in Go?
I would say your representation is favorable when someone wants to work with arbitrary JSON in a flexible fashion. However if schemas and code generators are available, I would prefer to use those.
* Processing 300GB of zipped text/access logs (my first attempt was in python and was much slower)
* Writing a git hook / git repo processor (again, first attempt was in python doling out to the git process alot. It was nice to compile a single binary for the hook, instead of worrying about having the correct python version installed)
* I'm writing a web service in Rust right now. It's a little rough around the edges honestly, but once async/await lands, I think I'll be much happier. The type safe templating and endpoint definitions I'm using are very nice, but probably not unique to rust. The compiler is also slow.
So probably not the best bet for webdev yet, but useful in other contexts.
The current futures proposal is on track for stabilization[1]. You can use futures with async/await today in nightly, and what you use will probably be exactly what lands in stable soon.
The biggest missing piece is documentation, but thats starting to improve. My go-to for examples is the futures test suite[2]. And if you want more features, futures-preview 0.3alpha adds a bunch of useful future combinators[3]. futures-preview now just wraps nightly's std::future, which is very nice.
Except for the missing documentation, rust's futures are looking great. You can have a play today if you feel keen to jump in. But, as you said it will take some time for the web development ecosystem to mature around the futures API.
[1] https://github.com/rust-lang/rfcs/pull/2592
[2] https://github.com/rust-lang-nursery/futures-rs/blob/master/...
I personally wouldn’t build a website in Rust, but a webserver? Yeah, maybe.
I think you'll find a wide range of responses to this question, as personal preferences tend to vary quite a bit. For my two cents, I really enjoy using Rust, and I find myself super productive in it compared to other languages. In broad terms, I find Cargo to be miles ahead of any other build tools/language-specific package managers in terms of ergonomics, and in broad terms, I find the language to be expressive enough to save me a lot of time in having to define things I would have to in other languages and the compiler powerful enough to ensure that I don't break things when doing so. Granted, it takes time to learn how to leverage the expressiveness, and I can understand that not everyone will value this as much as things like being able to ramp up new developers quickly. I'll give the caveat that I don't actually do much web development, so my comments about expressivity/ergonomics describe the language itself and not the web ecosystem.
tl;dr Pleasant is subjective, but yes, some people (like myself!) really enjoy using it
That said, I find Rust very pleasant to use. I don't have to make as many defensive copies of things or reach for as many immutable data structures, because I have much stronger guarantees around what code is allowed to mutate what data. I'm a fan of static typing, and I really like that enun matches will fail to compile by default if you haven't handled all the cases. There's a lot of explicitness like that, and I find explicitness pleasant. But of course different people feel differently about that, and there's also the widely acknowledged learning curve for lifetimes and borrowing.
If anyone likes to compare apples with oranges and benchmarking web frameworks, actix-web framework (optimised for benchmarking, naturally) is leading in many categories: https://www.techempower.com/benchmarks/#section=data-r17&hw=...
With actix-web, you can run asyncio and sync code in the same server. It lets you take full advantage of Rust's concurrency.
Glad I'm not the only one who was struggling with gigantic and confusing error messages that were fixed by trial and error (usually adding a `.map_err(|_| ())`).
Will actix-web become obsolete or be replaced when Rust releases async/await in 2019?
It will use a slightly older futures, but that's why there's a compatibility layer, and I'm sure they'll update fairly quickly after stabilization and so you could just use that version as well.
* Extending other languages, like Ruby, Python, and JavaScript, for various tasks. Usually when performance is paramount.
* Web services (though see below)
* Infrastructure, such as Amazon's announcement today: https://news.ycombinator.com/item?id=18539539 and quite a few other things, like Chef's Habitat product, Boyant's linkerd2, Dropbox's core infrastructure, or System76's hardware flashing tooling
* Cryptocurrency stuff of various kinds
* Databases, such as PingCap's TiDB
* Operating systems, like Google's Fuchsia (This one is arguably not "production", but they are one of the largest employers of Rust programmers, and keep hiring... so maybe consider this, maybe don't.)
* Version Control systems, like Facebook's Mononoke, or the internals of mercurial itself, as well as things like Pijul
* Cryptography, in some cases working alongside C to slowly port things over
* Video games, mostly indie stuff, though some AAA studios have started to use Rust for various things, and a new studio, Embark, is going all-in
We have a partial list of companies that describe their usage here: https://www.rust-lang.org/en-US/friends.html
This year, we identified four areas we really wanted to improve Rust on:
* Embedded development
* Network services
* WebAssembly
* CLI tools
These are other common areas we see people wanting to use Rust in the near future, or areas where we could significantly improve Rust for that given case.
EDIT: I forgot to answer your other question
> Does it only outperform them, or is it also a pleasant language to use?
Performance is a key thing we hear from people in web development, but increasingly, it's also memory usage, both in amount and stability. Less memory means less money spent on servers, and steady usage makes scaling calcuations easier. For example, crates.io is a rust-based web application, and it uses about 30MB memory resident at all times, last I checked. That's very little. More serious systems use more, but often significantly less than the JVM.
I had no idea rust was that prevalent
Who said it should be picked for web development?
It's however good for systems programming, libraries, embedded, data crunching, network systems, and so on...
These perhaps?:
https://github.com/SergioBenitez/Rocket
https://github.com/actix/actix-web
https://github.com/carllerche/tower-web
Not saying that is the primary use, but still a valid question as long as these libraries are being built/pushed.
I think things are much more viable for "services" rather than "sites" right now. And the npm thing is a service.
Personally I love Rust. I would choose to use it for web development top to bottom at this point, even with the current limitations of WASM (which is getting better) on the client side.
I’ve never used a language that can be brought to bear from the top of the stack to the bottom with the safety that Rust brings.
That’s of course me, and I wouldn’t force others to use it. I can finally use one language for everything, and that makes me happy. It’s entirely up to you to choose your language, and if you want to use a new one that has growing communities in each of these area, Rust is a great one to choose.
I have many hammers, one for small nails, on for large nails, a rubber one for joining things, even large sledge hammers. Each has its job.
But if I could only have one, that was flexible enough to use across all situations where I need to hit things, that would be great.
Personally, as polyglot developer, I rather use the best tool for each part of the stack.
Currently I see Rust better taylored for the low level layers that Windows, Android, macOS, iOS, MicroEJ still write in C or C++.
Do you also plan to replace SQL with Rust?
I’m not saying there are things available for all of these areas, nor am I saying that I think necessarily others should choose to rely on the language in some of these areas, unless you want to directly contribute to filling in those gaps (there are many people who are doing this). What I am saying, is that based on my experience with the language, especially in the context of Web Development, I would pick it for frontend and backend development at this point.
I agree that there are areas it really shines in right now, and if you’re working in those areas than I definitely push people in that direction. But yeah, for native GUI stuff, if you need to do more that toy stuff, it’s not ready yet.
> Do you also plan to replace SQL with Rust?
I’ve considered it! As a way of more replacing DB side procedures: https://github.com/clia/pgxr (an example of one option). What we can do with SQL is use code generators to type check the SQL at compile time.
If you need to write firmware for, say, a satellite, C# and Python are out because they have an intermediate step between your deployable and the machine instructions you eventually execute. You have an external dependency which adds a level of unpredictability. All three of your example languages are out because they are garbage collected languages, which makes them inherently unpredictable at runtime. The last thing you want is an OOM in the middle of a rocket engine burn.
Go and C# are competing with Python, Java, Ruby, etc. All languages you would write a web application in, but not a satellite's firmware.
Rust is competing with C and C++.
Yes, maybe not on a satellite's firmware, but on a Gemalto firmware, certainly.
https://www.gemalto.com/m2m/solutions/modules-terminals/indu...
https://www.gemalto.com/m2m/solutions/modules-terminals/indu...
Just two examples from their portfolio.
Naturally it depends on how much memory is available and real time constraints.
However something like MicroEJ is already happy with an ESP32 variant, and I guess Rust could replace its C layer.
2. Safety-critical hard realtime systems require far more determinism guarantees than a language/runtime alone can provide. For example, they require deterministic scheduling of threads (usually round robin with very strong prioritization guarantees and bounded task-switching latence), and so require a realtime OS. Also, safety-critical realtime systems have ways of guaranteeing bounded memory growth, for both the stack and the heap. These exist in specialized languages for realtime such as SPARK (an Ada variant) and SCADE.
3. Java is actually used in safety-critical hard realtime systems, including avionics, but in a special, hard realtime JVM that has different kinds of deterministic guarantees (when run on a realtime OS), including memory allocation, scheduling and hard deadlines for asynchronous events (see https://www.aicas.com/cms/en/rtsj). What's particularly cool about realtime Java is that it allows for a safe mix of realtime and non-realtime threads, as even in realtime systems, the actual realtime part is usually a small portion of the program.
(at the moment, it's tightly coupled to our game, however)
Also the compiler is pleasant and gives you helpful advice on how to make your program compile.
-> You trade some code noise for safety and speed. Compared to C++ the code has even less noise.
Turning code into concurrent code is super easy in Rust. Just use the Rayon crate and change iter() functions into par_iter() and you are done (if the borrow checker doesn't complain).
For me the robustness is great. It's not just memory safety, but strong type system without nulls is superb for avoiding stupid bugs (no more "undefined is not a function").
If you're writing a small blog, you probably don't need any of this — you won't hit resource limits, and you'll manage to write 100 lines properly in any language.
But if you need to process gigabytes of data, Rust may be super helpful:
https://blog.sentry.io/2016/10/19/fixing-python-performance-...
Performance is great, but the breadth of usage enabled by the small run-time (including no GC) makes it more exciting.
I don't really like any of the 3 languages you mentioned though.
What I think is driving Rust and will continue to drive Rust is how it compares to C/C++ in certain key areas:
- Ownership is enforced at compile time. C++ obviously has smart pointers now (ie std::unique_ptr and std::shared_ptr) but these come with not insignificant runtime cost. What's more you end up passing around raw pointers anyway at least some of the time.
- C/C++ do suffer from and will continue to suffer from memory corruption, buffer overruns and undefined behaviour resulting from this. This has been and will continue to be the source of security vulnerabilities.
- Security is becoming so important and software so large and complex that the need for memory safety without sacrificing runtime speed will become increasingly important.
I honestly see a point where there'll be a need for a safe OS that is written in Rust or something like it.
One other thing about Web development: I think this is one area where Rust offers no real benefits (other than memory safety). Honestly I think the best model for serving HTTP requests is the cooperative multitasking model used by Hack (FB's PHP successor) where everything the request uses and does is created and torn down within the scope of a single request. This is a model that's far easier to reason about.
I came from years of doing Java where we had to deal with full GC pauses (something Go isn't immune to either).
I think C++ is a more apt comparison. C is such a barebones language. Yes, it's very unsafe and Rust goes a long way to fix those issues, but Rust brings a lot of other features along with it which dial the language complexity up to 11.
I would like to see a simple language that fixes C's biggest problems. I think that would be really interesting to work with. Nobody seems to want to do it though, or if they have, they haven't been able to get any attention.
> I would like to see a simple language that fixes C's biggest problems. I think that would be really interesting to work with. Nobody seems to want to do it though, or if they have, they haven't been able to get any attention.
Honest question from an embedded C developer who's learning Rust, but still very beginner:
Wouldn't using a subset of Rust provide the same thing you're asking for?
Cyclone, Safe C, Checked C, static analyzers deliver with the compiler, ...
The problem is on the receiving end, some devs won't change no matter what.
So far Android and Solaris (SPARC) seem to be the only platforms with memory validation compilation turned on.
It's also fantastic for reliability. In the same way that Java and C# represent a step up from python/php/js in compiler driven correctness, Rust represents another jump of similar magnitude.
To unpack, this means that it's still a language that is very "close to the metal" in terms of lack of overhead, and broadly follows the don't-pay-for-what-you-don't-use C++ maxim. But at the same time, it's a very high-level language with lambdas and ADTs and destructuring.
Had Bjarne not taken that decision and C++ would having drinks with Modula-2, Pascal, Oberon and others.
So it was both a bless and a curse.
Rust seems to be increasingly adopted in spite of being different, so lets see when it gets a nice OS SDK sweet spot.
It's not that good for rapid prototyping, won't please many big enterprises who don't trust it and can't hire maintainers easily, and it can't do much on mobile phones. There are also some types of integration work where you'd be wasting your time with rust due to lack of domain specific crates.
as for how `rustup install nightly`
The Rust team has also done an unprecedented job of balancing stability and improvement.
> When asked why they used nightly, people responded with a broad range of reasons including: access to 2018 edition, asm, async/await, clippy, embedded development, rocket, NLL, proc macros, and wasm.
wasm, clippy, embedded, and proc macros aren't nightly any more. NLL, 2018 edition are coming soon. (December 6)
In particular, using nightly allows you to opt-in to a number of experimental language features in exchange for maintenance burden. It's not a choice I make, although it's fun to do every now and then just to get a feel for what's available in the nightly builds.
For example, I use actix, which works really well. It's not as ergonomic as Rocket, but it's way faster and quite useable. The same is true for pretty much everything I need, so I only use nightly when I'm dinking around with something that doesn't need to go to production anytime soon.
My (possibly mistaken) understanding is that my coworkers who do more web servery stuff than me prefer actix to rocket for other reasons too, and wouldn't use rocket even if it worked on stable.
I don't really know the arguments around them, TBH.
Using unstable anything on production software is not professional, on mission critical software it is reckless incompetence.
I've currently switched to nightly to use the 2018 edition changes already, which will soon be unnecessary.
Almost all libraries work fine on stable now. (the new async/wait support is an exception, but it's still very experimental right now and not used by many)
Important note: You can always develop on nightly and get potential speedups etc, but not use any features and then deploy only with stable.
You say that, but we've already come out the other end of the period where linux was still on the upward swing of popularity and if a development toolchain wasn't as easily available a lot of software may never have taken off as quick.
The ability to easily install a development toolset to compile (even if safely hidden behind a script to download and compile something like Ruby, Python, Perl, or a module for one of them) is a major boon, even if just used to create packages for the distribution's package system for local distribution (e.g. creating an RPM from spec).
Given the choice between an easily installable default that might get old or no first party option provided, having a default available is vastly better. Blame companies for poor options they choose, not the people and organizations that do their best to provide even a single option.
The RedHat devtoolset was a nice solution to this (use a newer gcc version, but link to the system libraries), but if that isn't available, then building with the system compilers helps in this area.
Rust doesn't have this problem when rust programs are statically linked, but if distros start shipping rust shared libraries which other programs start depending on, and/or some of the rust standard lib ends up in a system shared library, some of the same issues may arise (or maybe not, rust may have solved them in a clever way).
They do need to recompile the world when they update the compiler, but it's a single recompile each time.
I don't know much about modern Windows (SxS, etc) so things may have improved there, but last I looked (a while back admittedly) DLL hell and shared object issues were in different leagues.
>so I don't need to distribute libstdc++ and libgcc_s with my program
Could you explain why you want to avoid that?
Meanwhile you get access to more and better tools, which has no impact on the stability of your code base but a positive impact on productivity. It enables you to decide to bite the bullet and give up on language stability for new useful features if you want to (which I often do, for nll).
So, what I do is develop on nightly, and make things I want other people to use work on stable.
What do you do with the stuff you make on nightly? Use it only for yourself?
Edit: oh, I think I see: you don't use any new features when you develop on nightly.
(This may not be what your parent is talking about, but it is a use-case I've seen before.)
Incidentally, what do you use the syscall crate for? I'm very curious!
(I was looking into it because I was trying to do system calls without having a stack page mapped as part of an assembly sandbox).
They may also be willing to hand it over to you, I don’t know.
Using nightly as the compiler is much easier in Rust than, for example, using Python 3 early on was, because unlike, say, Python 3, nightly is fully backwards-compatible to earlier stable releases. (While not being backwards-compatible to previous nightlies.)
This means it's easy to limit yourself to the features used in stable + one major change you want, and if there is no change to that major feature, you won't even notice all the instability of the compiler.
There has been some hope of people moving to stable versions as NLL hits them, I think most people will always want the next big feature (personally waiting for const generics) on nightly, at least until the language is a lot more complete.
9 more days!
Or used in larger projects. Or used in environments where (a) dev's prefs cannot be nightly.
We know of several codebases that are over a million lines. To some people, that's big, and to many, it's not.
(Note also that this data shows a majority of people do use stable.)
This boggles my mind, so I have to ask, who considers a million lines of code in a code base not a large project? I mean, sure there are plenty of projects larger than that, but when considering whether a project is large or not, I think I would consider a million lines of code well into the "large" category.
Add in a general sense of bragging rights, and well, I've heard people say "call me when you have a real project" about more absurd (to me) things than just this in the past...
> (Note also that this data shows a majority of people do use stable.)
Well, that kinda proves my point then, right?
> What's a "large project" to you, incidentally?
It's more that the larger the project (either in code or number of devs working on it), the more tool-stability becomes a requirement. Just my experience, and it is quite understandable.
https://github.com/rust-lang/rust/issues/43234
Took me a bit of websearching to figure out what people were excited about.
Additionally, even that is kind of jargon. The simplest answer is “the borrow checker will allow some kinds of code that is sound, but the previous borrow checker could not understand that it was sound.”
I would have thought literally every programmer on earth would have heard of rust. Whether they have looked into it or use it would be a different question. But unless those programmers don't keep up with their tools, I find it hard to believe they don't know about Rust.
We are not representing the majority here
If they have not heard of Nim, Crystal, D, then I would not be surprised. But Rust?
That is like saying programmers have never heard of Swift.
They may not know anything about it. But not "heard" of it, is.... strange?
Hell i work for a car manufacturer with thousands of devs. Most of them have not heard from anything since early 00s Perl, PHP and Java. And they have not moved. Everything newer is "Startup stuff, we live in the real world here"
I mean to be honest, it is a great thing for me. As my specialty is to cleanup and replace that kind of systems, ala 18f/USDS. I have an easy job finding for my whole life.
But hell it makes it hard to talk with the "vocal" people out there.
I think pie charts are perhaps better when you've got, say two to four items and labels are short enough to be in place instead of off to the side.
We're not exactly data scientists... maybe for next year we'll make some of these changes.
It makes sense when compared to the rich Python ecosystem. Coming from a C++ background I consider the Rust library ecosystem to be one of its strong points already!
In a sense, I agree with you. Certain kinds of features available in the Rust ecosystem are much more easily available than in the C++ world, and there's been a lively pace of articles published about libraries and applications in Rust. But another sense I got from looking at libraries to use myself and applications to learn from was that the ecosystem is quite smaller and ... not quite as matured as the C/C++ ecosystem (I'm _completely_ ignoring FFI for this argument). Of course, all of this is completely natural, and I'm simply not expecting them Rust ecosystem to be competitive with the much older C/C++ ecosystem(s), but this realization does temper my excitement with Rust a bit.
But having a gamedev background we tend to roll most things ourselves. C++ is such a hodgepodge of mixed build systems that adding a moderately sized library is a huge PITA.
If this is the case then its a bit misleading as it could be loads of people asking for a single thing, rather than people asking for better library support in general.
I don't think the Rust Standard lib is too bad, so i'm also surprised its so high up.
I only really use C#. I've kicked the tires on Rust and Elixir, and I could see myself using Elixir on a personal project but unlikely I'll ever have a good usecase for Rust.
It does power a large portion of my Firefox browser, so from that sort of usage viewpoint I'm using something built with Rust everyday, which I can't say likely will never say for Elixir, discounting the other language on the BEAM platform.
Are you as productive in rust when doing web front-end development as in javascript? Are you as productive when doing one-of scripts as in perl? Are you as productive when doing exploratory data analysis as in python? Are you as productive when doing database queries as in SQL?
This is obviously a subjective question. You will feel productive once you have a sufficient grasp on the language and the parts of the ecosystem you need.
Basically no-one will have Rust as a first language so there will be a point of comparison to other languages too.
There are still things I'd have trouble doing. I used to do game development professionally, and I still don't think I'd use Rust for it. I also have worked on virtual machines and high level programming language runtimes, and I wouldn't want to write a GC in Rust.
(Yes, I've seen shifgrethor[0] and the rustconf 2018 closing keynote[1] (I was there, actually) -- both are great, but they're almost more examples of my point; Rust makes certain patterns much harder).
It is all a matter how it is implemented and the additional language features for manual types and control of allocations, and how good the compiler backend is transforming all that AST information into actual code.
Something like Modula-3, Active Oberon, System C#, Eiffel, D and so forth.
In higher-level languages the indirection and allocation are so ingrained into the language users don't even realize it's there (how many people know that basically every class member access or function call in python involves a hash table lookup?). If you try to do the same in rust you find you need to say where you want the runtime tracking and indirection to occur, and in general this means you use less of it, but it doesn't mean you should tie yourself in knots trying to avoid it. A little more eager use of trait references, Rc, and RefCell makes for a much better rust experience, but there's a strange psychology to it which makes people unwilling to do it, even when they know it's there and how to use it (and there is a difficulty of teaching beginners that it is there and how to use it).
We’re still, as a project, working on i18n. Conducting the survey was one of the big first steps. We’ll get there.