
Considering Rust [video] - Jonhoo
https://www.youtube.com/watch?v=DnT-LUQgc7s
======
zamalek
I've just "incompleted" my first Rust project: a Minecraft server. I gave up
due to the protocol, not Rust. I finally learned the damn thing after spouting
its hypothetical advantages all over the internet. My overall conclusion was
correct, but the reasoning incorrect. The borrow checker is an amazing pair
programmer, but that's not the primary reason I'm having genuine fun.

Rust is a systems language that _is a pleasure to build._ This "how to build
on Mac/Windows/OSX" is a non-issue and should be a non-issue. Solving how to
build something is an utter waste of time and is complete bullshit.

Please, for the sanity of the rest of us, stop using C build systems. They are
just unbelievably terrible; people have tried and tried, but you can only do
so much with a fundamentally flawed bad idea.

~~~
PureParadigm
Couldn't agree more. I often have to install programs from sounce, and dynamic
linking, header files/include paths, etc. make the C build system extremely
unreliable. It's often more of a trial and error process ("which library is it
going to be missing next") than a methodical one. I've spent countless hours
hunting down why libfoo.so isn't loading correctly, or why some random
function is undefined at the compile stage.

------
carapace
> Jon Gjengset

> The Rust programming language has become a serious contender in the space of
> "systems" programming languages, and has recently been adopted by many of
> the tech giants for "serious" projects. In response to this, more companies
> are now considering whether they too should add Rust to their tech stack.
> This talk hopes to help you make that decision. We go through how the
> language compares to many current alternatives and what the language has to
> offer, but also what it's primary drawbacks are and its long-term viability
> prospects.

[https://jon.thesquareplanet.com/slides/considering-
rust/expo...](https://jon.thesquareplanet.com/slides/considering-
rust/export.pdf)

~~~
lemmox
Jon has been working on a reasonably large Rust project called Noria[1], "a
new streaming data-flow system designed to act as a fast storage backend for
read-heavy web applications".

I found his Rust live coding sessions on YouTube[2] to be an enjoyable
introduction to Rust.

[1] [https://github.com/mit-pdos/noria](https://github.com/mit-pdos/noria)

[2]
[https://www.youtube.com/channel/UC_iD0xppBwwsrM9DegC5cQQ](https://www.youtube.com/channel/UC_iD0xppBwwsrM9DegC5cQQ)

------
olalonde
I've been getting into Rust lately and really enjoying it so far. Coming from
JavaScript, It can feel a bit verbose at times and I'm still trying to get an
intuitive grasp of ownership but it feels like a really small cost compared to
say C/C++. A nice bonus is that it has very good support for
WebAssembly/Node.js which makes it easy to start using Rust for some
JavaScript modules without having to re-write the whole codebase. And finally,
the community is still very noob-friendly.

~~~
Waterluvian
I felt the same, coming from JavaScript and Python. Then I realised
"verbosity" is actually "the language demanding you be crystal clear about
what you're asking and that every code path is covered."

I just can't go back. Typescript gives me most of this. But Python feels just
awful to me now. It's like an entire kind of cognitive load is being
eliminated from my day.

~~~
throwaway894345
I’ve had some luck with Mypy, but it’s still very bolted-on. Even getting the
type checker to find dependencies installed on your system is nontrivial. But
this sort of tedium is just par for the course with Python.

------
melling
I'm 20 minutes in and he's spending a lot of time talking about how Rust gets
correctness right.

Are there any anecdotal stories about how Rust programs have fewer errors?

Facebook, for example, rewrote Messenger with ReasonML:

[https://reasonml.github.io/blog/2017/09/08/messenger-50-reas...](https://reasonml.github.io/blog/2017/09/08/messenger-50-reason)

And it had a lot fewer bugs:

"Messenger used to receive bugs reports on a daily basis; since the
introduction of Reason, there have been a total of 10 bugs (that's during the
whole year, not per week)! *"

~~~
ravloony
anecdote incoming!

In my previous gig, we had a premium website hosting platform, and our
incoming clients would usually want their old inbound links to keep working.
Over time, this meant a few hundred thousand autogenerated rewrite rules in
Nginx. This was causing Nginx to use about 10G of memory, so restarting it,
which we had to do every time we added a redirect, was an issue.

I replaced this with a small reverse proxy written in rust that loaded all of
the redirects from postgresql into a cuckoo filter. Adding a redirect was an
INSERT, followed by a NOTIFY to let the proxy know to add the redirect to the
filter.

Putting it all together took about 2 weeks of swearing at the compiler, but it
never had an issue in production, and used about 1M of memory, while adding
less than 1ms of latency, or about 4ms in case of a filter hit. Cuckoo filters
can have false positives, so if a redirect was found, we still had to check in
the db table before returning 301.

As far as I know it's still working fine, and I use rust whenever I can.

~~~
mleonard
Interesting! Any chance you can share a few tips to get started doing the
same? (eg any crates to use or other tips). I'm currently looking for a rust
learning project and building what you described really hits the mark!

------
loopz
Rust is interesting, so I decided to include it in a 3 language prototyping
project. I wanted to experience how it is to code for these languages,
compared to the outcome. The project was dead simple, read 2 files
concurrently and match lines by id's. Data was a bit unstructured, some lines
would go unmatched, some would be duplicates, and report on that while
deallocating memory for processing large filesizes.

Ruby: Quick fun building the classes and methods. A bit trial and error on
dynamic errors. Processing was 40x slower than golang implementation though,
so felt a bit discouraging after the fact. But was fun language to prototype
OO in! Nice for quick'n dirty projects.

Golang: I didn't find need for OO or interfaces, so simplified for processing
code mostly. The language helped in this regard, as it is quite imperative-
driven. Golang was the fastest language to develop in, and showed Ruby version
to be a bit over-engineered.

Rust: Never coded in Rust before, I searched SO for most relevant code
examples and patched it up from several examples. I didn't go into the deeper
end of things or optimize anything, but instead spent 90% of the time writing
naive processing code while battling the compiler. If I'd been proficient,
perhaps no battle, but this required the longest dev time and processing was
noticably slower than Go, though not by a factor.

From this short anecdotal experience: Ruby for quick'n dirty fun or OO
modelling. Golang for prototyping _and_ initial versions. Rust for where _you
know_ you need safe parallellism and special optimizations. Right tool for the
job!

~~~
aldanor
For me, Rust also fits "fun language to quickly prototype type system in", but
I've been hacking in Rust since its 0.* days; if I were to try to do it in
Ruby/Go which I've barely ever touched, it would sure take me way much longer.

If I were to compare Rust to Python/C++ which I'm proficient in, Python would
be the fastest because there's zero setup time, tons of quality packages and
notebook environment; C++ would take a lot longer due to having to set up
builds, and due to lacking stdlib and ecosystem.

------
_bxg1
Even as a fan of Rust I've become exhausted by these posts. Surely everyone on
here must at this point know what Rust is and roughly why people use it?

~~~
melling
I don't think Rust has reached wide acceptance yet.

Sure there are companies that use it, but I bet you'd have a hard time
convincing your manager that Rust is widely accepted in industry.

Anyway, I certainly appreciate all of the posts.

~~~
_bxg1
Not widely accepted in industry, but widely accepted (or at least known) among
HN readers

~~~
nazka
Which is a very small percentage of people in tech. In my network Rust is
still very new to unknown in some tech companies. I will say Go is more the
language that emerged.

~~~
_bxg1
Yes but we're not talking about the prevalence of these in general, just on HN

------
alexandercrohde
Can somebody please explain why Rust has so much buzz right now compared to
scala?

Scala is a strongly typed, very-well vetted, functional programming language
in the JVM. It pretty much has everything going for it. It's even adopted by
twitter.

~~~
wffurr
JVM, garbage collected, doesn't have zero overhead abstractions.

Might as well ask why Scala didn't take over from C++.

~~~
alexandercrohde
I don't know why you'd be dismissive of that comparison. Scala is more like
Rust than any other language he discusses.

~~~
tomlu
Because performance is a P0 concern to a lot of people. Rust (and C++) has
performance as a primary goal, Scala does not.

~~~
alexandercrohde
Did you even watch the video? The guy is comparing rust to things like Python
which is a pretty silly comparison, relative to scala.

~~~
carlmr
Everybody knows python, few people know Scala. Isn't that enough of a reason?

