
Why I love Rust - vasuadari
https://speakerdeck.com/jvns/why-i-rust
======
middleclick
I want to spend at least 3-4 months learning a new language but just can't
figure out if I should spent time learning Rust or Go. I am thinking more of
it from a career perspective than interest.

~~~
hellofunk
I actually think you'd go far to spend 3 - 4 months learning C++. Almost every
language you can likely encounter in your career will use some feature that
will get introduced to you in C++, especially modern C++, and, almost any
language will be easier to learn and use after first going through a C++
learning curve.

Besides, C++ is still the big player, more than all others. Even Apple's new
language Swift is written in C++. It's a good language to know something
about.

It also sets you into a different category of programmers, from what I have
found recently, since C++ techniques are not taught much in college programs
any more (based on my conversations with recent CS grads), which really
surprises me. It's a special skill that would set you apart if you know it.

~~~
jbandela1
I think that is a great answer. I actually see some parallels between the
relationship of Rust/C++ to Scala/Java. Both basically use the backend of the
established language and provide an 'improved' language on top of it. Scala
uses the JVM, and Rust uses LLVM.

What is interesting is that with the release of Java 8, a lot of Scala early
adopters and cutting back their investment in Scala in favor of Java (for
exampled LinkedIn). This is despite the fact that Scala is widely used in
production, has a killer app in Spark, and allows pretty seamless use of the
Java library.

Now compare this to Rust. Rust also provides an 'improved' language in the
same space as C++ utilizing LLVM. However, what is interesting is the nature
of the improvements. The biggest feature of Rust is the memory safety.
However, the memory safety is not a productivity improvement as more of a
safety improvement. Unlike garbage collection where you just do not have to
think about memory allocation issues, Rust forces you to think about ownership
and mutability. That same exact thinking will allow you to pretty much get the
same memory safety in C++ using unique_ptr and shared_ptr and const. The
difference is that the compiler makes you think about it in Rust. Much like
Scala inspired the adoption of features for Java, you can see C++ adopting
pretty much the borrow checker as a tool - see Herb Sutter's talk at CppCon
2015 -
[https://www.youtube.com/watch?v=hEx5DNLWGgA](https://www.youtube.com/watch?v=hEx5DNLWGgA)
.

As the experience with Scala shows, the adopted features of the established
language do not have to perfectly match the 'improved' language to convince
people to migrate back to the established language. The adopted features just
have to be in the ballpark. I think the new C++ tooling will be in the
ballpark in much the same way that Java 8 is in the same ballpark as Scala and
remove much of the impetus for moving to Rust from C++.

In addition, Rust is not as well positioned as Scala. Scala is actually
deployed in production and has a killer application. Rust has no major
production deployments of which I am aware and no killer application (the
equivalent of Spark). In addition, while Rust can interface with C libraries,
Rust cannot interface with C++ libraries unlike Scala which can interoperate
with the Java standard library.

Rust has some brilliant aspects just like Scala has some brilliant aspects.
However, C++ (like Java) is not sitting still but has been incorporating the
best ideas. In addition, when people choose a system language, they are
inherently conservative because the system they are creating will typically be
long lived and mission critical. If you are writing something that you hope
will power your company for the next 20 years, do you want to go with a
language created and driven by Mozilla with no major use in production, or
with the language that powers Google, Microsoft, Apple, and Facebook?

Here is what I recommend. Learn C++11/14/17\. Learn Haskell to really open
your mind to what is possible. Learn Rust to learn about the borrow checker.
Then apply what you have learned to make yourself a better C++ programmer.
Some of the best, most insightful C++ programmers I know are people who are
actually well-versed in other languages, especially functional programming
languages.

~~~
steveklabnik

      > you can see C++ adopting pretty much the borrow checker as a tool
    

This may be because I'm too close to it, but the Core Guidelines are similar
in ways, but also very different. Preventing data races is an explicit non-
goal, for example, whereas in some ways, it's the focus of the borrow checker.

    
    
      > Rust has no major production deployments of which I am aware
    

Dropbox is the latest production user, as of last month. And it's serious
production usage: how the bytes get stored on disk, basically the core of the
whole business.

~~~
nickpsecurity
I'd _really_ like to know how well that works out at Dropbox. How honest and
public do you think they'd be if major data losses resulted from Rust crapping
out on them? I'm not sure about them but lots of businesses keep such things
on the DL.

I think it's a risky move. I'd have first deployed existing, native code along
with Rust in parallel using the data splitting technique so some is saved with
original and some with Rust. Any compiler or library related issues on Rust
side would be caught without data loss. I wonder if they did this in alpha
stage and how long that lasted.

I mean, I love seeing Rust in production and some success stories would be
great. It's just... wow, that's pretty mission critical for what I gather is
still a beta-phase tool. I'd be testing on the middle or front-end layers
first given they're usually stateless(ish).

~~~
pcwalton
> I think it's a risky move.

> It's just... wow, that's pretty mission critical for what I gather is still
> a beta-phase tool.

I think this is very '90s thinking. Extreme "if it's not C++, you can't deploy
it!" conservatism about programming languages hasn't been true for well over a
decade. Paul Graham has written some nice essays about this very phenomenon.

Also, Rust is not "a beta-phase tool".

New languages are much easier to deploy since the PL Renaissance. There are a
few holdout industries that still stick with C++ no matter what, such as
games, but they'll come around eventually. :)

~~~
nickpsecurity
You've been in discussions on this forum where I slam both C and C++. I'm
clearly against it unless I absolutely _have_ to use it due to its issues.
That's why your strawman is more amusing than most. My actual argument was
that new tools are usually unstable in terms of features, implementation bugs,
and (with compilers) performance. So, default recommendation for mission-
critical apps are mature tools whose strengths and weaknesses are well-
understood so pro's can use them robustly.

Back to beta-phase claim, you're saying the core features and compiler of Rust
are no longer in development or testing? Totally stable now with only
extensions, library features, and optimizations being added? If so, that's
good news and I'll drop that claim in the future. Otherwise, it's in the beta
phase. Another hint would be existence of any bugs with core functionality in
your compiler or libraries.

Again, though, if the spec and core functionality are frozen with all bugs
fixed then I won't call it beta. Is it there yet?

~~~
pcwalton
Yes, 1.0 is stable and the language will not change in backwards incompatible
ways. It's been that way for months (google "rust stability deliverable").

"All bugs fixed" rules out every language in existence except CompCert, so I
don't think that's a very interesting metric.

~~~
nickpsecurity
Good to know on stability part. Far as bugs fixed, it's more on the lines of
day-to-day use of the language in common scenarios. Are people getting
unnecessary troubles out of the compiler? Typically don't for most languages
as they work out most of them in common idioms and library functions in first,
few years. If they're serious rather than 1-3 people's hobby, that is.

I certainly won't expect it to be bug free. Nice comeback with CompCert,
though. ;)

~~~
fiedzia
I've seen rust compiler bug once and that was long before 1.0. The only issue
now is that some important API's are not yet declared stable (RFC still being
open), so many 3rd-party libraries target nightly and won't work in stable.
This is however matter or 1 or 2 releases, and proves that rust developers
take this matter seriously and don't wont to stabilize anything they aren't
100% sure. For all practical purposes rust is usable now, and more and more
people are using it - certainly more then 3. Generally looking at rust
projects on github, most of issues are feature requests. I don't see issues
with crashes or panics, while I know plenty for similar projects written in C,
at least in their early days.

~~~
nickpsecurity
Thanks for the detailed assessment. Sounds like a high quality, Beta to me. I
also like the good things I keep hearing about the quality of libraries, etc.

------
timClicks
What I really love about Julia Evan's posts/talks is how refreshingly honest
she is

------
nickpsecurity
Good presentation with a great, artistic style. Also liked her articles about
speeding Java up and "A/A testing."

Far as this one, the only correction I have is regarding the slide that says
you can't write an OS in Java. Several have been written w/ JNode and JX OS
coming to mind immediately. JX is my favorite given its interesting
architecture is mostly compatible with high assurance requirements. Just needs
a high assurance implementation. A re-write of such an architecture in Rust
might be interesting. Or SPIN OS as it was done in Modula-3 before.

~~~
mike_hearn
Yes indeed, and of course we must not forget Singularity/Midori which were
implemented in a derivative of C# and .NET

I'd really like an OS built this way to become competitive. 64 bit flat
address spaces and fully type safe designs really let you simplify things a
lot in some fundamental ways. And you'd be able to run existing Java desktop
apps without much in the way of porting effort.

Unfortunately all the Java OS's out there are hobby/academic projects that
never got very far beyond a basic window manager.

~~~
nickpsecurity
Yeah, that is unfortunate. JX OS at least might be useful for single or
minimal purpose appliances. Maybe soft-real-time or non-real-time embedded,
too.

Singularity, esp Midori per Duffy's blog, were the biggest pushes into an
inherently better OS's for desktops. I hope we see more Midori move into
Windows or other tech.

------
dplarson
Another great piece of content from Julia Evans :)

------
n0us
I like the idea of rust but what does this cartoon have to do with anything?
Am I missing something?

~~~
steveklabnik
It's a presentation.

------
tux
This should be made into comics strip "RustOS" ^_^ Thanks for fun read.

------
jokoon
I know C++, and have never encountered the 'let' keyword, until I tried some
haskell.

What does let mean ?

~~~
icen
It just means to bind a variable:

    
    
        let x : u32 = 0;
    

In Haskell, it's used for temporary definitions, or pure definitions in do
blocks:

    
    
        let f = \x -> x + 1 in f 2

------
loaaa
Rust is Pyramid scheme

