These are chat archives for rust-lang/rust

9th
Feb 2017
Peter Atashian
@retep998
Feb 09 2017 02:11
@Photon156 If you want to write software with higher performance and lower memory usage and more robust against programmer errors
Felix S Klock II
@pnkfelix
Feb 09 2017 11:12
@Photon156 Rust provides stronger safety guarantees than Java with respect to concurrency, namely: Data race freedom.
Aleksey Kladov
@matklad
Feb 09 2017 11:16
Even if Rust does not fit your domain, you might want to learn it because Rust will affect the way you think about programming, being very different from Java :)
Peter Atashian
@retep998
Feb 09 2017 11:17
@pnkfelix Java specifies that all loads and stores of primitives are atomic (aside from long/double), so there aren't that many data races
but it provides zero guarantees beyond that, which still lets you have all sorts of fun race conditions which can totally screw up everything
Felix S Klock II
@pnkfelix
Feb 09 2017 11:18
@retep998 ah that's a good point. Seems like there should exist a definition for a stronger property that Rust could claim over Java that is actually significant, like you say
Peter Atashian
@retep998
Feb 09 2017 11:20
@pnkfelix Java also lets you mark methods as synchronized ensuring that two synchronized methods don't run on the same object concurrently, but you have to specifically opt in to that
Felix S Klock II
@pnkfelix
Feb 09 2017 11:22
@retep998 yes and that means is that you end up poetntially blocking due to contention. I suppose the same is true for some types/protocols in Rust, but being able to reason about absence of contention (due to non-aliasing) is an interesting property from my POV
Peter Atashian
@retep998
Feb 09 2017 11:23
The big thing that Rust provides is that in Rust your values are guaranteed to not change on you unless you explicitly use types with internal mutability, while in Java all reference types can change their value on you
even in the absence of threading, this solves problems like iterator invalidation
Felix S Klock II
@pnkfelix
Feb 09 2017 11:24
@Photon156 in Java's terminology, this means Rust does not have ConcurrentModificationException. It simply cannot arise.
Peter Atashian
@retep998
Feb 09 2017 11:25
yep
Sasha Hilton
@sashahilton00
Feb 09 2017 18:31
hi guys, I’m looking to cross compile a rust program that uses portaudio for an armv7 device. I’ve used https://github.com/japaric/rust-cross as a guide, and compiling without port audio works fine, but fails with port audio. Is there any way to compile against a prebuilt version of portaudio19-dev that targets armv7?
Ashley Mannix
@KodrAus
Feb 09 2017 22:02
..
It
M
L
I
MN
Tim
@tikue
Feb 09 2017 22:53
can't you get a rust equivalent of ConcurrentModificationException via clever use of RefCell?
BorrowMutError
Denis Lisov
@tanriol
Feb 09 2017 22:58
Well, technically you can, but (a) you have to go out of your way by using RefCell and (b) you'll still have to handle this possibility while in Java this is an unchecked exception and you most likely won't expect it.
Tim
@tikue
Feb 09 2017 23:06
you don't have to handle the possibility
borrow_mut() simply panics
Denis Lisov
@tanriol
Feb 09 2017 23:09
Hm... yeah, it does :-( but point (a) still stands - while in Java this is the default, in Rust you need a special wrapper to allow this behaviour which won't be there in many cases.