Rust - The Modern System Programming Language

A Taste of Rust

Why Rust is Awesome?

Featuring:

Awesomeness #1: Zero-cost abstraction

What you don’t use, you don’t pay for. And further: What you do use, you couldn’t hand code any better.

[Stroustrup, 1994]

Awesomeness #2: Trait-based generics

Play

Awesomeness #3: Memory safety

A#3.1: Ownership and Borrowing

Classical problem: Memory leak

Play

A#3.2: References and Mutability

Classical problem: Concurrent data races

Play

A#3.3: Lifetimes

Classical problems: Use after free

Play

Awesomeness #4: ADT and Pattern Matching

Play

Awesomeness #5: Type System

Awesomeness #5: Type System

Play

Rust's advantages over C++

  1. cargo ecosystem
  2. Safety
  3. Simplicity of design
  4. Modern language constructs

But Rust is not perfect

  1. Value-returning flavor error handling
  2. Lack of OOP
  3. Too many macros
  4. Steep learning curve (even for C/C++ hackers)
  5. Still in fast evolving
  6. Too many types of pointers, closures, strings ....

Rust in the wild

Misc

Servo - The Modern Parallel Browser Engine

Motivation

Why Mozilla want to invent a new language to write something to replace Gecko (in C++)?

How does the effort pay off?

Performance and Benchmark

Performance and Benchmark (Cont.)

Servo v.s. Gecko

Browser Internals 101

Browser Internals 101 (Cont.)

Browser Reference Architecture

Browser Internals 101 (Cont.)

FireFox Architecture

Servo's Architecture

Task supervision diagram

Servo's Architecture (Cont.)

Each constellation manages a pipeline of tasks:

https://github.com/servo/servo/wiki/Design

Servo's Strategies for parallelism and concurrency

Personal Experience of Hacking on Servo

Roadmap

Servo needs you

Misc

Most Loved PL in 2016 is Rust

https://stackoverflow.com/research/developer-survey-2016

Rust just turns one year old

Rust 1.0 was released at May 15, 2015. Here is a post on the past year.