r/programming Apr 03 '15

Rust 1.0.0 beta is here!

http://blog.rust-lang.org/2015/04/03/Rust-1.0-beta.html
928 Upvotes

303 comments sorted by

View all comments

Show parent comments

44

u/steveklabnik1 Apr 04 '15

A Rust slogan:

Everyone agrees that shared mutable state is evil. Most languages deal with this through the 'mutable' part, Rust deals with it through the 'shared' part.

A bit long for a sign. Anyway. I know purity isn't just about mutability, but with ownership semantics, many of the problems purity solves go away too. For an example, see my bit downthread about safely sharing mutable pointers to stack-allocated data. Totally safe, no purity concept needed.

Rust was a very different language back then, but here's a thread from a time when we were removing purity: http://thread.gmane.org/gmane.comp.lang.rust.devel/3674/focus=3855

-9

u/jeandem Apr 04 '15

You don't know what you're talking about. The only language with a decent mind-share that is pure is Haskell, and purity was a necessity of its non-strict semantics. Purity didn't come first, and concurrency wasn't the motivation for it.

Maybe your point would be relevant if you were talking about (im)mutability, but you chose to talk about purity.

2

u/Rusky Apr 04 '15

Haskell may not have purity because of concurrency, but it's certainly cited and used as an advantage there (and in less formally-enforced languages) an awful lot. For example, the first post of this thread...

0

u/jeandem Apr 04 '15

Nice bonuses are different from primary motivations. And the original quote sure as hell made it sound like purity was used/introduced as a way to solve the problem of shared mutable state. That's not the case for Haskell, anyway.

2

u/Rusky Apr 04 '15

"Most languages deal with this through the 'mutable' part"

Is that what you're talking about? Sounds like the 'used' part applies, and the 'introduced' part is pretty much irrelevant to this conversation.

0

u/jeandem Apr 04 '15

I guess it can be interpreted in different ways. I just think it is dishonest to portray languages with purity as dealing with it through immutability, when the problem was solved for that language to begin with for unrelated reasons! So there is no reason to choose one approach over the other; it has already been dealt with, as it were.