
One Year with Rust: I wrote a full featured application in rust, and so can you - vitiral
http://vitiral.github.io/2017/02/25/one-year-with-rust.html
======
jfaucett
I've been doing a lot of rust lately and I have to say it blows c/c++ out of
the water. Sure, c/c++ has more libs, but almost every other feature in rust
is fantastic, and wrapping a clib via ffi is really easy in rust. My only
(minor) complaint with rust is that they aren't pushing no_std enough IMHO,
but I'm biased since all my code is no_std :) so obviously I'd like to see a
lot less work in the stdlib and more on stabilizing low-level stuff and
creating better apis there for doing things that are currently kind of
annoying like creating your own data structs, and doing bit manipualations in
fast math libs, etc.

Anyway rust is awesome, especially cargo (finally sane build/package
management/versioning for a systems language). I will never code in c++ again
if I can help it.

~~~
RcouF1uZ4gsC
By that way, in referring to C++, are you referring to modern C++ or C with
classes? Whenever is see people criticizing C/C++, I suspect they are doing C
with classes style programming and (rightfully) hating that.

~~~
coldtea
> _I suspect they are doing C with classes style programming and (rightfully)
> hating that._

Rightfully? People resort(ed) to "C with classes" to make C++ tolerable and/or
reliable.

If anything, it's the opposite: when most people complain about C++ it's about
C++ itself, the full language, and its whole baggage of features and their
obscure interactions and intricacies. Not about using C++ as C with classes.

------
pimeys
Yes. Finding Rust and doing some real things with is has been mindblowing. I
have mainly Ruby/Scala/Python/Clojure background and I've only written a small
lisp with C before, so Rust had some new concepts I needed to tackle. Now I've
made my first app using Tokio having one asynchronious thread and a couple in
sync. And even with hard concurrent/parallel code, if it compiles, it usually
works.

Getting there might be a challenge sometimes, especially when you're just
starting. But believe me learning Rust is worth the trouble.

------
lossolo
What I would like to see is story from someone that is C/C++ expert and
transitioned to Rust with their performance sensitive software, not
side/hobbyist project, but real product working in production. I am interested
in challenges that this person/team had, in which situations using unsafe was
a must, what kind of performance problems they had with Rust abstractions (not
all are cost-free) etc. And I emphasize on projects that strictly needed to be
written in C/C++, not for example web api which requirements allowed it to be
written for example in Java/Go etc.

Anyone like that here that could share his story?

~~~
kibwen
On vacation so no links, but check out posts from Andrew Gallant (ripgrep,
regex), any of the Servo/WebRender/Stylo experience reports from the Firefox
team, and I there're some reddit comments out there about Rust's use in
production at Dropbox.

~~~
mos_basik
thanks for the pointers; I was curious about Dropbox's approach and found this
thread in the rust sub, if others are interested:
[https://www.reddit.com/r/rust/comments/4adabk/the_epic_story...](https://www.reddit.com/r/rust/comments/4adabk/the_epic_story_of_dropboxs_exodus_from_the_amazon/)

------
seabrookmx
Seems odd to compare Rust and Python.

They're different levels of abstraction and I think are both great languages
that serve different use cases.

I'm always going to be more productive in Python. And Python has an awesome
ecosystem for web apps. Rust gives you native compiled binaries, concurrency,
and speed in general.

Why you'd consider these two languages for the same app is beyond me.

~~~
mahyarm
I really wish python had a good concurrency story, it would last far longer as
a language if it did. The GIL is why it's reducing in popularity.

~~~
paulddraper
> The GIL is why it's reducing in popularity.

Unlikely. Python, Ruby, PHP, Javascript all do not have in-process
parallelism.

In contrast, C/C++, Java/Scala/Clojure, Go, and Rust all have in-process
parallelism.

This just furthers seabrookmx's point that Python and Rust belong to two
different classes of useful languages.

\---

P.S. Python's multiprocessing module is an order of magnitude better/easier
than anything in the other scripting languages I listed.

~~~
seabrookmx
Agreed. People always mention the GIL like it's the achilles heel of Python,
yet when discussing NodeJS the single threaded nature is almost described as a
feature.

Anyone reading hackernews knows that Node doesn't have an issue with
popularity (and AFAIK Python doesn't either).

------
frozenport
How do I make a GUI application in rust? Does it have support for Qt, MFC, or
maybe WPF?

~~~
vitiral
Just personal opinion here, but I think GUI's should/are being phased out. I
much prefer writing a front-end web app and package it inside the application.
That's what artifact does.

~~~
frozenport
But at present I don't know how to use this approach for the imaging or CAD
software I develop.

I need the ability to share GPU data between front and back ends, along with
accurate timings for the control of various hardware devices. This is possible
with Java (think the design of MATLAB or Mathematica) but the additional glue
to enable cross language communication doubles the code size. That is why I'm
sticking to C++ and Qt.

~~~
vitiral
CAD software would definitely be an exception!

I think they are JUST starting with some gui frameworks for rust,so I think
the language is a little behind there. Never done extensive searching though

------
rajandatta
a very helpful perspective. Going from Python to a language with static types
and different approach to concccurrency. Thanks for sharing!

------
ryanolsonx
Was your experience with Rust comparable to your Elm experience? I've been
coding a lot in Elm lately and LOVE the reliability of the everything. Once
you make it past the compiler, you know that it's not going to crash and that
you'd managed all possible cases.

(I bring this up since using Elm was mentioned in the article)

~~~
vitiral
Rust is much more feature full, allowing you to do things (like mutate data)
that you can't do in elm. It also has a lot of new concepts (like lifetimes).
All of these things are to allow for ultra high performance applications - it
can run as fast or faster than C!

One nice thing about rust is that everything is explicit. If someone can
mutate your data, you have to pass "&mut" to them and declare your variable as
mutable. This gives you a good balance of both performance and control.

It also has the benefits that make elm great like no exceptions, pattern
matching, etc.

So ya, they are different languages but share a lot of the same concepts and
benefits.

~~~
ryanolsonx
That's awesome. I'll definitely have to give it a go then!

------
robin__
Your tool and book look very interesting. I'll give them a try.

~~~
vitiral
Thanks, I would love any feedback!

