SlideShare ist ein Scribd-Unternehmen logo
1 von 20
54 26'42" S 3 19'2" E




    I belive in Rust
    An intruduction to the Rust programming language


1      22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Disclaimer

    • I am an Rust newbie
    • Rust is in 0.31 and have probably changed
      since I wrote these slides. Example code
      might not compile with the latest and
      greatest.




2     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
So what is Rust
    •   A programming language from Mozilla labs
    •   Compiled un-managed language
    •   Ahead of time compiler
    •   Concurrent-oriented
        – Message passing
        – Default immutable variables (mutable keyword)
    •   Lambda expressions with a lot if easy to use code
    •   Classes and traits
    •   No NPE crashes, libs use Option<T> or Result<T,U>
    •   Unsigned types (Singed byte is a bad idea)

3        22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Preparing for hello world

    • Git clone and build from source
       – Dependencies
             •   G++ 4.4 or above or clang++3.x
             •   Python 2.6 or later
             •   Gnu make 3.8.1 or later
             •   curl
    • Download binaries
    • Emacs and Eclipse plugins
    • http://dl.rust-lang.org/doc/tutorial.html




4     22. august 2012    I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Simple hello world




5    22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Tasks




6    22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Task management

    • An Rust program consists of a tree of tasks,
      with their own stack and sole ownership of
      allocated heap data
    • Communicate through ports and channels
    • Propagates failures to its parent (the task
      spawned this one) unless unsupervise
      function is called.
    • May be executed in parallel and are
      scheduled by the runtime
    • Has its own GC

7     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Proper hello world




8     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Rust vs Java

    • Java has global GC Rust has per-task GC
    • Rust does not share memory but
      communicate through message passing
    • Rust is compiled to native AOT compiler
    • Rust is per default immutable
      – Use the keyword mut to create mutable
    • Rust has unsigned types
    • No null pointer crashes
    • High order functions for iteration


9     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
High order functions




10     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Pattern matching




11     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Pattern matching example




12    22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Ports and channels




13     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Ports and channels example




14    22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Modules and crates




15    22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Unit testing

     • Compiles with the --test flag and run
     • Not external lib but part of the compiler 




16     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
The Servo Parallel Browser
     Project
     • Servo is a web browser engine written in
       the Rust language. It is currently developed
       on OS X and Linux.
     • https://github.com/mozilla/servo




17     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
Yegge’s laundry list

     • Dave Cheneys blog post on Go
       – “While languages like Julia or Rust approach 100%
         coverage of Yegge’s laundry list, it is still to be seen if
         they will achieve mainstream adoption.”




18     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
The list for Go




19     22. august 2012   I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
I believe in rust

Weitere ähnliche Inhalte

Was ist angesagt?

ProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementWei-Ning Huang
 
.NET Standard - Introduction
.NET Standard - Introduction.NET Standard - Introduction
.NET Standard - IntroductionImmo Landwerth
 
Microfrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased basedMicrofrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased basedVinci Rufus
 
.NET Standard - Under the Hood
.NET Standard - Under the Hood.NET Standard - Under the Hood
.NET Standard - Under the HoodImmo Landwerth
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Railselliando dias
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPythonNick Hodge
 
The Saga of JavaScript and Typescript: in Deno land
The Saga of JavaScript and Typescript: in Deno landThe Saga of JavaScript and Typescript: in Deno land
The Saga of JavaScript and Typescript: in Deno landHaci Murat Yaman
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildCTruncer
 
PHPKonf Istanbul 2016 - From development to production with Docker Datacenter
PHPKonf Istanbul 2016 - From development to production with Docker DatacenterPHPKonf Istanbul 2016 - From development to production with Docker Datacenter
PHPKonf Istanbul 2016 - From development to production with Docker DatacenterKiratech
 
The internet of $h1t
The internet of $h1tThe internet of $h1t
The internet of $h1tAmit Serper
 
.NET Standard - NuGet Analysis
.NET Standard - NuGet Analysis.NET Standard - NuGet Analysis
.NET Standard - NuGet AnalysisImmo Landwerth
 
Posladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript aPosladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript aPeter A. Pirc
 
what is .net
what is .netwhat is .net
what is .netSireesh K
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your NetworkCTruncer
 
Sly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingSly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingStefan Marr
 

Was ist angesagt? (20)

Veil-Ordnance
Veil-OrdnanceVeil-Ordnance
Veil-Ordnance
 
ProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacement
 
.NET Standard - Introduction
.NET Standard - Introduction.NET Standard - Introduction
.NET Standard - Introduction
 
Microfrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased basedMicrofrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased based
 
.Net standard 2.0
.Net standard 2.0.Net standard 2.0
.Net standard 2.0
 
.NET Standard - Under the Hood
.NET Standard - Under the Hood.NET Standard - Under the Hood
.NET Standard - Under the Hood
 
.NET - The Current Spectrum
.NET -  The Current Spectrum.NET -  The Current Spectrum
.NET - The Current Spectrum
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
The Saga of JavaScript and Typescript: in Deno land
The Saga of JavaScript and Typescript: in Deno landThe Saga of JavaScript and Typescript: in Deno land
The Saga of JavaScript and Typescript: in Deno land
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the Wild
 
PHPKonf Istanbul 2016 - From development to production with Docker Datacenter
PHPKonf Istanbul 2016 - From development to production with Docker DatacenterPHPKonf Istanbul 2016 - From development to production with Docker Datacenter
PHPKonf Istanbul 2016 - From development to production with Docker Datacenter
 
Basics of Networking
Basics of NetworkingBasics of Networking
Basics of Networking
 
The internet of $h1t
The internet of $h1tThe internet of $h1t
The internet of $h1t
 
Crystal
CrystalCrystal
Crystal
 
.NET Standard - NuGet Analysis
.NET Standard - NuGet Analysis.NET Standard - NuGet Analysis
.NET Standard - NuGet Analysis
 
Posladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript aPosladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript a
 
what is .net
what is .netwhat is .net
what is .net
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your Network
 
Sly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingSly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of Programming
 

Andere mochten auch

Andere mochten auch (8)

Briefly Rust
Briefly RustBriefly Rust
Briefly Rust
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
 
Lisbon rust lang meetup#1
Lisbon rust lang meetup#1Lisbon rust lang meetup#1
Lisbon rust lang meetup#1
 
Guaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in RustGuaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in Rust
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
 
Rust-lang
Rust-langRust-lang
Rust-lang
 
Tour of Rust
Tour of RustTour of Rust
Tour of Rust
 
Mozilla + Rust at PCU Manila 02 DEC 2016
Mozilla + Rust at PCU Manila 02 DEC 2016Mozilla + Rust at PCU Manila 02 DEC 2016
Mozilla + Rust at PCU Manila 02 DEC 2016
 

Ähnlich wie I believe in rust

02 introductionto java
02 introductionto java02 introductionto java
02 introductionto javaAPU
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
Сергей Моренец: "Gradle. Write once, build everywhere"
Сергей Моренец: "Gradle. Write once, build everywhere"Сергей Моренец: "Gradle. Write once, build everywhere"
Сергей Моренец: "Gradle. Write once, build everywhere"Provectus
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovydeimos
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastUzairSaeed18
 
Gradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesGradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesStrannik_2013
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gatesStrannik_2013
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)David Bosschaert
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Stfalcon Meetups
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakSigma Software
 
Erlang Embedded — Concurrent Blinkenlights and More!
Erlang Embedded — Concurrent Blinkenlights and More!Erlang Embedded — Concurrent Blinkenlights and More!
Erlang Embedded — Concurrent Blinkenlights and More!Omer Kilic
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereStrannik_2013
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfssusercd195b
 
The dedexer disassembler
The dedexer disassemblerThe dedexer disassembler
The dedexer disassemblerGabor Paller
 
ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019Rory Graves
 

Ähnlich wie I believe in rust (20)

02 introductionto java
02 introductionto java02 introductionto java
02 introductionto java
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Сергей Моренец: "Gradle. Write once, build everywhere"
Сергей Моренец: "Gradle. Write once, build everywhere"Сергей Моренец: "Gradle. Write once, build everywhere"
Сергей Моренец: "Gradle. Write once, build everywhere"
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovy
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 Fast
 
Gradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesGradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypes
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gates
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr Sugak
 
Functional solid
Functional solidFunctional solid
Functional solid
 
Erlang Embedded — Concurrent Blinkenlights and More!
Erlang Embedded — Concurrent Blinkenlights and More!Erlang Embedded — Concurrent Blinkenlights and More!
Erlang Embedded — Concurrent Blinkenlights and More!
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
The dedexer disassembler
The dedexer disassemblerThe dedexer disassembler
The dedexer disassembler
 
ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019
 

Mehr von Reidar Sollid

Mehr von Reidar Sollid (7)

Erlang workshopdrammen
Erlang workshopdrammenErlang workshopdrammen
Erlang workshopdrammen
 
Rust baksia2014
Rust baksia2014Rust baksia2014
Rust baksia2014
 
Erlang crash course CiA Oslo 2012
Erlang crash course CiA Oslo 2012 Erlang crash course CiA Oslo 2012
Erlang crash course CiA Oslo 2012
 
Actors drammen
Actors drammenActors drammen
Actors drammen
 
Io lang
Io langIo lang
Io lang
 
Actor three languages
Actor three languagesActor three languages
Actor three languages
 
Scala actors erlang
Scala actors erlangScala actors erlang
Scala actors erlang
 

I believe in rust

  • 1. 54 26'42" S 3 19'2" E I belive in Rust An intruduction to the Rust programming language 1 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 2. Disclaimer • I am an Rust newbie • Rust is in 0.31 and have probably changed since I wrote these slides. Example code might not compile with the latest and greatest. 2 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 3. So what is Rust • A programming language from Mozilla labs • Compiled un-managed language • Ahead of time compiler • Concurrent-oriented – Message passing – Default immutable variables (mutable keyword) • Lambda expressions with a lot if easy to use code • Classes and traits • No NPE crashes, libs use Option<T> or Result<T,U> • Unsigned types (Singed byte is a bad idea) 3 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 4. Preparing for hello world • Git clone and build from source – Dependencies • G++ 4.4 or above or clang++3.x • Python 2.6 or later • Gnu make 3.8.1 or later • curl • Download binaries • Emacs and Eclipse plugins • http://dl.rust-lang.org/doc/tutorial.html 4 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 5. Simple hello world 5 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 6. Tasks 6 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 7. Task management • An Rust program consists of a tree of tasks, with their own stack and sole ownership of allocated heap data • Communicate through ports and channels • Propagates failures to its parent (the task spawned this one) unless unsupervise function is called. • May be executed in parallel and are scheduled by the runtime • Has its own GC 7 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 8. Proper hello world 8 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 9. Rust vs Java • Java has global GC Rust has per-task GC • Rust does not share memory but communicate through message passing • Rust is compiled to native AOT compiler • Rust is per default immutable – Use the keyword mut to create mutable • Rust has unsigned types • No null pointer crashes • High order functions for iteration 9 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 10. High order functions 10 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 11. Pattern matching 11 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 12. Pattern matching example 12 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 13. Ports and channels 13 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 14. Ports and channels example 14 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 15. Modules and crates 15 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 16. Unit testing • Compiles with the --test flag and run • Not external lib but part of the compiler  16 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 17. The Servo Parallel Browser Project • Servo is a web browser engine written in the Rust language. It is currently developed on OS X and Linux. • https://github.com/mozilla/servo 17 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 18. Yegge’s laundry list • Dave Cheneys blog post on Go – “While languages like Julia or Rust approach 100% coverage of Yegge’s laundry list, it is still to be seen if they will achieve mainstream adoption.” 18 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E
  • 19. The list for Go 19 22. august 2012 I belive in Rust JavaZone 2012 | 54 26'42" S 3 19'2" E

Hinweis der Redaktion

  1. An executing Rust program consists of a tree of tasks, each with their own stack, and sole ownership of their allocated heap data. Tasks communicate with each other using ports and channels.When a task fails, that failure will propagate to its parent (the task that spawned it) and the parent will fail as well. The reverse is not true: when a parent task fails its children will continue executing. When the root (main) task fails, all tasks fail, and then so does the entire process.A task may remove itself from this failure propagation mechanism by calling the unsupervise function, after which failure will only result in the termination of that task.Tasks may execute in parallel and are scheduled automatically by the runtime.
  2. Comm is now pipe