Fun facts about Rust's growing popularity
jonathanturner.org
jonathanturner.org
This is the same kind of thing even if less stomach turning than the negative crud. It's pretty crappy and doesn't really belong here any more than Oracle and IBM global services adverts do. It is not anything like objective and in any sensible assessment of Rust should be roundly ignored. Just like big consulting firm whitepaper "Are you enterprise ready!?!?!"
All the very best to Rust hackers, may you achieve your technical goals in both your design and implementations and have loads of fun on the way!
> you get this kind of "My programming language and community are already wonderfully perfect and kick more goals than there are nets to kick into"
It doesn't say how wonderful Rust is, it says how many contributions it had, how many users on gitter, etc. You can interpret that like you want, but that's just your interpretation.
The resulting fact is then "Amazon is hiring for developers with Rust experience.". If a candidate checks the other boxes they'd probably hire them if they knew VisualBasic... :)
Personally I don't like this forceful advertising stuff unless maaybe it's for a really good social cause which is otherwise ignored. e.g: privacy
This attitude pisses me off because advertising is a necessary task in all projects. It doesn't matter if it's commercial or completely free, volunteer-built open source software. You need to advertise the project to ensure enough people know about it to achieve a lasting, critical mass of users and developers. But this attitude establishes a norm of resentment towards project maintainers who are just trying to do well by their projects and their users. I think young people pick up on this and it makes them reluctant to promote their own projects.
I have no use for "know your place"isms.
Now, my predicament: I love Rust's type system and tooling, but it's really hard to justify to myself the pain of writing correct Rust code (borrowing, lifetimes, etc.) when I know I can get almost the same effect by using a GC language + immutable messages.
And I don't need that last drop of performance either.
So if you just want a native language with a good type system and a growing ecosystem, where do you go? Still Rust or something else?
It's true. Ever since I got familiar with the ownership concept, I've taken to writing C# IDisposables with disposable member variables like this:
public MyObject(){
this.myResource = new DisposableResource();
this.ownsMyResource = true;
}
public MyObject(DisposableResource resourceToUseThatIDontOwn){
this.myResource = resourceToUseThatIDontOwn;
this.ownsMyResource = false;
}
public void Dispose(){
//not pictured: .NET's boilerplate dispose code
if(ownsMyResource) myResource.Dispose();
}
For the client I'm contracting with right now, mismanagement of disposable resources is the #1 issue in the codebase. 100k lines of code, and it's never clear who should be disposing connections. There are some objects with multiple constructors (like above) that have 'conditional' ownership. In Rust, it's impossible to have this problem, period...although the above C# construct simulates it, lol.>The drop flags are tracked on the stack and no longer stashed in types that implement drop.
But just as a counter-argument, look how a simple lock looks like in Rust [1]:
fn main() {
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _ in 0..10 {
let counter = counter.clone();
let handle = thread::spawn(move || {
let mut num = counter.lock().unwrap();
*num += 1;
});
handles.push(handle);
}
//...
}
[1] https://doc.rust-lang.org/book/second-edition/ch16-03-shared...----- edit: Just to clarify my point. The ownership model is a beautiful solution to the resource management problem. And as the parent pointed out, some concepts can be cleanly borrowed/reused in other languages.
But now, in Rust, in practice, you realize that this model requires a lot of boilerplate code just to make the borrow checker happy, even for simple things like using a lock: create Arc(Mutex(data)); clone the arc reference; move the new Arc reference to the new thread.
extern crate crossbeam;
use std::sync::Mutex;
fn main() {
let counter = Mutex::new(0);
crossbeam::scope(|scope| for _ in 0..10 {
scope.spawn(|| *counter.lock().unwrap() += 1);
});
println!("{:?}", counter);
}
Four lines to declare a mutex, start 10 threads that all lock that mutex, increase value behind mutex, unlock mutex, and join all spawned threads. There is a lot going on here (unwrap is arguably a noise here however, but the rest is straight to the point).Also, it's possible to use atomic ints here instead of mutex. Verbosity of mutex actually helps a bit, because locking is fairly expensive and it's better to avoid locking if possible.
Something like
withLock(counter, (num) => {
return num + 1;
});
or in alternative, withLock(counter, (ref num) => {
num++;
});
If C# allowed for trailing lambdas it could look better.Yes it can be a pain to write. But I prefer the pain of making the compiler happy than the pain of debugging a weird segfault.
[0]: https://dlang.org/
* compiled, statically-typed, GC'd
* _very_ fast compilation (this is DMD; haven't tried the other two implementations (one on LLVM, the other on GCC))
* very fast executables
* easy linking with and use of C libraries
* familiar and practical
> And I don't need that last drop of performance either.
You probably write more highlevel code? Rust is --as the name implies-- most suited for close-to-the-metal code. This is often where that "last drop of performance" counts.
There are a lot of projects that really could be written in a high-level language, but they were started when C was still preferable due to the immaturity of higher-level solutions. I think it is sad that people, looking at these aging and unaudited C codebases, are thinking about rewriting them in Rust, when rewriting them in e.g. Python might make better sense. Very little Free Software needs to be so close to the metal, and it was just a historical accident that we got so much written in C.
So the historical accident was UNIX/POSIX taking over the majority of OS architectures.
I agree... apart from the Python bit. :) When deving software that is very big (LOC) or very widely distributed (FLOSS packages), then I prefer "well typed" languages that do not need a VM/interpreter.
My personal answer to that is OCaml. The only thing I miss there is good concurrency support. I can see how this might open a whole new can of worms. Would we still use locks, or some addition to the type system like Pony's reference capabilities?
I wish there was a higher level Rust sublanguage where heap allocation and GC was default, and you would use the "bare" Rust for the fast core of your program.
I'd like to see a language that is both systems and high level at the same time, with trivial interop and a common build system + package manager.
This could e.g be a set of low level extensions added to C# (Span<T>, ref returns etc is getting there) or a high level wrapper language/subset for e.g. Rust.
There is always a best tool for the job, and most jobs might require two tools, so it would be great if those two tools were aware of each other and came in the same toolbox.
The two most mature, well-designed languages in the Rust world are Gluon [1] and Dyon [2]
I believe there is a _great_ opportunity for something like Terra [3] but woven into Rust. Perhaps with the same type of compiler plugin that enabled HolyJIT [4]
The grail is having both a GC and an ownership based gc-free lower level all in the same language. Start dynamic, harden to static and sprinkle in properties.
As a side note, I have been thinking about how to bolt ownership onto a dynamic language and then I learned about Snowflake [5]. I think it would be totally doable to bolt ownership onto Java using annotations and AoT subsets of a program, completely escaping the garbage collector. This would be like Terra++
[1] https://github.com/gluon-lang/gluon
[2] https://github.com/PistonDevelopers/dyon
[4] https://github.com/nbp/holyjit
[5] https://www.microsoft.com/en-us/research/publication/project...
The core language "just works" pretty pleasantly on other *nixes, I don't know about windows.
You end up missing Apple-specific libraries a lot, though. There are some packages making progress on that problem, but a comprehensive replacement for e.g. audio or graphics surfaces is a ways off, I think, if only because of the fragmentation that exists in those spaces on other platforms. Of course, Swift has that problem only a little worse than any other language that ships without an OS.
On Linux there is official support for Swift.
The "core language" pretty much works great on Ubuttnu, but there are still minor annoyances getting it installed, or building it, on Linux. Other Linux targets, also doable, but more annoying. Windows, I haven't really heard of people doing for real. Not sure that's even on anybody's radar.
What's really awesome is how far Swift has come with the core lib Foundation, which is a from-scratch clone of Apple's Objective-C and closed-source macOS/iOS Foundation library[1], written in Swift, in the open. It is not done, but huge swaths of it are now done[2], and that makes coding in Swift on Linux a lot more pleasant, since we don't typically want to waste time rolling our own regex support, Unicode string manipulations, basic geometry routines, HTTP networking, date formatting, etc. But Foundation is a huge, almost 30-year-old library that has evolved continuously and has shipped with every OS X/macOS/iOS release. An open-source Swift re-implementation of that sounded like "yeah right" bullshit/fantasy when they announced it but now it looks very real just a couple years later.
Tooling is different issue, though. Swift is a modern language with excellent support for auto-completion and in-editor hinting and help. People complain about it all the time, but Xcode is so much better than any IDE on Linux (or any other platform) for coding in Swift that I do most of my Swift-on-Linux work using a Mac, with Ubuttnu running in VMWare Fusion. If a basic editor will do, though, you have a lot of choices. For builds and package management, Swift Package Manager is now built into Swift, and works great. (It also has an option to automatically generate Xcode project files from Swift packages, which is hugely useful; my practice, and I think the prevailing or at least emerging convention, is to keep the package and source in git but treat the Xcode project as a throwaway item, not in version control, that can be generated whenever needed. So you don't need Xcode, but its easy to use for editing convenience when you want, assuming you have a Mac. But not all devs need to have Macs.)
I think you still have to like Swift a lot to choose it for your Linux project, but it is doable. I'd be surprised if Swift adoption on Linux didn't quintuple or sextuple by the end of 2018.
[1]: https://github.com/apple/swift-corelibs-foundation
[2]: https://github.com/apple/swift-corelibs-foundation/blob/mast...
One of the reasons iOS is more smooth than Android there's no "OK I'm going to GC a million objects right in the middle of your scroll" performance dip but it will release all objects more gradually through ARC at a slightly bigger total performance cost.
Ask C devs why they (still) think Swift is a PITA to work with compared to Objective-C. Luckily in most scenarios you can use Objective-C mixed with Swift to get the advantages of both scenarios.
Haskell?
Or on today's HN: https://news.ycombinator.com/item?id=15582429
If Nim could mature a bit it would be really nice. There is OCaml but it is a bit goofy to work with if you prefer more imperative style coding. There is Go but no generics.
OCaml is a good choice. The ecosystem is definitely growing, though maybe not very quickly.
Nim[1] is a good alternative to Rust if you don't mind a GC, and I argue that even for use cases where a GC might be problematic it's still a good choice thanks to the Nim GC's soft real-time capabilities.
This one jumped out at me. I'd be curious how this compares to other languages. (I know nothing about rust besides that I see it on hn all the time, impressive list though!)
"Supporting Rust by Using Rust" https://www.youtube.com/watch?v=4-H6Hn_i4PQ
So we got two compilers in the box.
Plus having almost copy-paste compatibility with C, meant we could enjoy higher productivity with a more safer language, and leave the other unsafer one on the drawer.
Of course, nowadays we are paying the price of the copy-paste compatibility that helped the language gaining adoption in first place.
1 - https://nim-lang.org/blog/2017/10/01/community-survey-result...
I enjoy Doctor Who (though it's been getting worse for the last 5 or so years) but I do NOT want to be called a Whovian.
What's the first image that pops into your head when I say "Trekkie"? It's probably not someone with good health and hygiene, is it?
Personally I think it's quite creepy and dystopian. Then again, is it worse than wearing t-shirts with the name of a software project on them outside of conferences about that specific software? That's kind of cringy/cultish too, when you look at it from the outside, but it doesn't feel that bad when large parts of your life revolve around that particular software.
I did not mean to say that being cute needs to go away. If you want to have a teddybear on your desk called Mr. Snuggles, that doesn't bother me in the least.
What bothers me is cutesy labels like what we're talking about here. They're so commonly used in a manipulative manner that I have trouble seeing them as anything other than scary.
I don't like them for when people watch TV or listen to music or use a programming language. And I despise them when companies try to act like there's a strong bond between employees by breaking them out.
Very, very creepy. Please don't contribute to that. That's all I wanted to convey.
I apologize if it comes off as sexist, because that's not my intent. Cutesy labels trip my cultometer. Hard. It's a creepy indoctrination technique, and I'm incredibly uncomfortable with it, especially after having grown up in a very gaslit home.
and probably, you are ;)
How do I even properly pronounce it? "Rah-stah-kyan", "Rah-stah-see-an", "Rah-stah-seen"? Complete non-starter if you can't talk about it.
I'll keep my "Pythonista" business cards - this rolls off the tongue easily and ignites conversations with non-techies.
I'd guess "Pythonista" or "gopher" are much better in that regard because they are almost obvious to pronounce in other languages using the Latin alphaber. They are only one "th" or "ph" away from regular German, for example.
However, in cases where people say that some language is bad, it means that it simply does not fit their tasks.
(sorry, im using google translate)
I disagree. It is possible for a language to simply be a bad language. Intercal is intentionally so. I will refrain from mentioning unintentionally bad languages in order to avoid a flame war.
In fact, the flame wars can also be useful as an advertisement.
[1]: http://www.jonathanturner.org/2017/10/(https://blog.rust-lan...
[2]: https://blog.rust-lang.org/2017/09/05/Rust-2017-Survey-Resul...
"Are you a top rustacean and looking for a challenge in AI and Big Data and want to work in an international team with young and dynamic rustaceans? "
Stodgy old conservative shops can call them Rust developers.
Everybody is understood, everybody wins!
If the "metal" is the existing ecosystem of languages, then the name would imply that it will slowly eat away and replace code that's been written in other languages.
Really, it’s a better analogy for Rust programs than programmers themselves, but associations don’t have to be exact. I see it as very much positive and cool.
I think I’ve seen Rubyist here or there, but it’s still not common (based on my somewhat extensive Bay Area Ruby job search early this year). It’s also the most standard grammatical construction, and doesn’t sound too punny or playful at all (which can be a good thing depending on the tone you want to set on your resume or job posting).
You can call yourself whatever you want. "Talk is cheap, show me the code."
- the parity ethereum client: https://github.com/paritytech/parity
- the exonum framework: https://exonum.com/
100 companies betting money on Rust.