chiark / gitweb /
finished B
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 14 May 2019 16:27:25 +0000 (17:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 14 May 2019 16:27:25 +0000 (17:27 +0100)
talk.txt

index 9980de079faa7ebd007dfe82182ba9932ebe3a10..5eb0dc1291c760fd865cdda9d364607981f77d37 100644 (file)
--- a/talk.txt
+++ b/talk.txt
@@ -63,9 +63,29 @@ Borrows (that is, references) come in two kinds: mutable and
 immutable.  You can have many immutable references at once.  A mutable
 reference permits modification, and provides exclusive access.
 
-[ Borrowing example slide ]  https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references
+[ Borrowing example slide with mut missing ]  ABOVE https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references
+
+That's what the `mut' is doing in that example.  If you leave it out
+the compiler complains.  This is the Rust `borrow checker' that you
+have may have heard about: the part of the compiler which enforces the
+object ownership rules.
+
+Overall, this scheme makes use-after-free and double-free bugs
+impossible.  You have to work at it to make a memory leak.  Rust
+programs are safe (by default): you can write bugs, but you cannot
+randomly corrupt memory (or otherwise trigger what in C/C++ is called
+"undefined behaviour").  The ownership rules even give you safe
+multithreading!
+
+And, the ownership system means that the compiler can often optimise
+very aggressively, because it has really good visibility of all the
+aliases of and references to the objects its working with.  Compared
+to garbage collected languages, the ownership system eliminates a lot
+of runtime memory management.  I have found Rust programs to generally
+be very fast.
+
+
 
-That's what the `mut' is doing in that example.