chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 13:40:20 +0000 (14:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 13:40:20 +0000 (14:40 +0100)
talk.txt

index 43fc9949ba3a91d36adcaf841a78388d3e35e552..20eb9429bc71ee730f3888d9a6369f0ea1c65b26 100644 (file)
--- a/talk.txt
+++ b/talk.txt
@@ -91,17 +91,22 @@ 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.
+Sometimes advanced languages from academia 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
+Not Rust.  For me, 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's syntax is a conventional structure of curly braces, keywords,
+parentheses, and infix expressions.  It looks a lot like C or
+JavaScript or something.
+
+Rust is safe by default.  That is, bugs in your code can't corrupt
+memory the way that they do in C and C++.  But, unlike most other safe
+languages, if you really want full manual control, you can write
+`unsafe'.  This is rarely needed, even if you want really fast code.
 
 Rust is statically typed.  The compiler will typecheck it.  This is
 great.  You may have heard Haskell and Ocaml programmers say "once you
@@ -111,37 +116,21 @@ 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 
-
-
-
-
-
-You can lend Objects which 
-
-
-This ownership is
-known to the 
-
+Rust also has type inference (similar to Ocaml, Haskell, etc.), so you
+can often leave out the type annotations.
 
-tends to lead to 
+Rust supports polymorphism (also known as `generics'; it calls the
+feature `traits'.  They're a bit bit like C++ templates, but not mad.
+Rust supports dynamic dispatch (like `virtual' in C++), or static
+dispatch, but in both cases the typechecking is done at compile time.
 
+[ unsafe Rust/C/C++ example, chrobakpayne.rs glue.cpp ]
 
+Rust has a reasonably good system for interfacing to code written in
+other languages.  With the appropriate annotations, you can call C
+functions directly from Rust and vice versa.  (Of course this requires
+you to say `unsafe', since the semantics of the C parts of the program
+are not known to the Rust compiler so you must check them yourself.)
+Built on top of that are machineries for glueing Rust to, for example,
+Python.
 
-write explicit code allocate memory, and and free allre