From: Ian Jackson Date: Wed, 15 May 2019 22:41:29 +0000 (+0100) Subject: wip slides X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=f674b5ba0adcf7052a61dcad8ad5ee271b32f954;p=talk-2019-ghm-rust.git wip slides --- diff --git a/talk.txt b/talk.txt index cdf8f6b..a0970be 100644 --- a/talk.txt +++ b/talk.txt @@ -1,4 +1,6 @@ +[ intro slide - my language background ] + Hi. This talk is going to be, mostly, a plug for Rust. Those of you who know me may find this surprising. After all Rust in @@ -96,6 +98,8 @@ be very fast. C======================================================================C +[ overview slide? | syntax ] + 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 @@ -109,15 +113,23 @@ 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. +I'm going to zoom through a few of Rust's most important properties: + +[ syntax | safety ] + 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. +[ safety | type ] + 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. +[ type | inference ] + 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 @@ -129,6 +141,8 @@ work. Rust also has type inference (similar to Ocaml, Haskell, etc.), so you can often leave out the type annotations. +[ polymorphism ] + 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 @@ -191,6 +205,8 @@ E======================================================================E Of course nothing is perfect. I'm very critical by nature, so I often find things to gripe about. +[ borrow checker error ] + The most obvious difficulty with Rust, if you read the internet, is some's feeling they are constantly fighting the borrow checker. Personally I have not found this to be a problem at all. I think it @@ -207,6 +223,8 @@ of whose members is (or contains) a reference to another member. Luckily this doesn't come up very often, and it is still possible to hide the issue from the API's consumer. The awkwardness is tolerable. +[ serde | macro_rules! ] + Rust does have macros. In fact it has two ways to define macros (one built on top of the other). The more sophisticated macro system is very capable and has been used to really impressive effect. But it's @@ -214,6 +232,8 @@ hard to use casually; and the simpler macro definition facility is simultaneously too complicated and underpowered. So casual macro use is slightly awkward. +[ cargo - dw posts, links ] + But the worst problem is cargo. Cargo is Rust's language-specific package manager and build tool. It is really quite annoying. @@ -237,6 +257,8 @@ expect a culture which produces these kind of problems. F======================================================================~ +[ rust-lang, ian.jackson@ ] + Despite these difficulties, and of course a fair few minor irritations, I have found programming in Rust to be both fun and very productive.