From: Ian Jackson Date: Wed, 15 May 2019 12:39:29 +0000 (+0100) Subject: wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=c727b166a3a81388398fd4e56dc828723db3d958;p=talk-2019-ghm-rust.git wip --- diff --git a/talk.txt b/talk.txt index 5eb0dc1..43fc994 100644 --- a/talk.txt +++ b/talk.txt @@ -75,7 +75,7 @@ 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! +multithreading. And, the ownership system means that the compiler can often optimise very aggressively, because it has really good visibility of all the @@ -84,7 +84,50 @@ to garbage collected languages, the ownership system eliminates a lot of runtime memory management. I have found Rust programs to generally be very fast. +C======================================================================C +Apart from the ownership system, there is little new in Rust. +Nevertheless, it is an advanced language with a lot of expressive +power - power which is generally available without sacrificing +performance. + +Sometimes advanced languages from academia can be rather inaccessible: +they can feel like incomprehensible alien technology, with a steep +learning curve and an unfamiliar or even obscure syntax. + +Not Rust. Rust has managed to take the best - and most proven - +features of earlier research languages and package them up into a +whole which feels fairly familiar and is easy to use. + +Rust's syntax is built from the familiar structure of curly braces, +keywords, parentheses, and infix expressions. It looks a lot like C +or JavaScript or something. + +Rust is statically typed. The compiler will typecheck it. This is +great. You may have heard Haskell and Ocaml programmers say "once you +can get the program to typecheck, it will probably work". Rust has +the same experience. When in the throes of writing a complex +algorithm you can type some drivelous pseudocode into your text +editor. Then keep fixing errors until it builds and lo! it will often +work. + +For polymorphism, Rust has generics. These will be known to +Haskell programmers as typeclasses. + +They're a bit like C++ +templates, but not mad. + +For when you want runtime polymorphism, Rust has a dynamic dispatch +system. + +[ Example from bottom of xenstored/history.ml ] + + + + +, but Rust has + +Those other can (which can sometimes be