
Wrapper Types in Rust: Choosing Your Guarantees - Manishearth
http://manishearth.github.io/blog/2015/05/27/wrapper-types-in-rust-choosing-your-guarantees/
======
grok2
Sometimes I think that the complexity of concepts in Rust will prevent it's
large scale adoption for even it's intended uses. You can't blindly use
features, because you get tripped up on the compiler and to understand what
the compiler is saying you need to know the details of the things explained in
the article :-(. I write networking software for a living in C and would like
to use Rust, but the learning curve is pretty steep once you go into the kind
of things Rust is cool at.

~~~
Manishearth
I dunno, C++ has a similar level of complexity (lots and lots of features and
fiddly libraries). Blindly writing C++ causes segfaults and undefined
behaviour too.

The difference is that Rust complains at compile time, deterministically. So
Rust _feels_ like it's tripping you up, whereas you would have been tripped up
(without realizing it, often, because runtime) in C++ too.

The second difference is that people are used to C++ and don't recall how
complex it is.

~~~
grok2
Yep, C++ is complex too, but we've come to that complexity incrementally over
a long period of time...

~~~
Dewie3
All these different mutable/shared/etc. combinations look inherent to the
problem, i.e. inherent complexity. You'd have the same problem in another
language with the same intended goals. So what is the accidental complexity
that Rust is adding to the problem?

~~~
grok2
Unfortunately it is just the inherent complexity that is troublesome -- there
is a steep learning curve to get up to speed with Rust and I am worried that
the barrier is too high for most people to climb up -- either that or it will
take a while and a whole lot of tutorials/cookbooks until people get familiar
piecemeal with all the ways to work with Rust....

------
arthursilva
Great writeup! Deserve a spot on the official docs.

------
mkesper
"Copy" feels weird as name of a type. I translate it into "Copyable
(trivially)" internally, is that correct?

~~~
Manishearth
Yes, but `Copy` is a trait, not a type. Traits can be used as types but
they're ... different.

~~~
madez
I'm longing for formal definitions of type and trait, to see the exact
difference.

~~~
Manishearth
Types are types. Let's take a type system with generics but no single
inheritance.

Traits are properties that types can have, like Java interfaces though more
powerful.

Many traits can be used as types to form a vtable dispatch. For example,
Box<Send> uses the trait `Send` here as a type. Objects of type `Send` are
"unsized" and _must_ be held behind a pointer (which becomes a fat pointer).

~~~
Dewie3
> Traits are properties that types can have, like Java interfaces though more
> powerful.

The GP asked about _formal definitions_. So I think they want something more
precise than that.

~~~
Manishearth
I know, I was just clarifying my original statement :)

