Rust (language)


Rust is amulti- paradigm compiled programming language designed and developed by Mozilla Research 5 . It was designed to be “a secure, concurrent , practical language” 6 , 7 , supporting purely functional programming styles, actor model , procedural and object-oriented programming .

The language grew out of a personal project of chief developer Graydon Hoare who began working on it in 2006. His employer Mozilla began his participation in 2009 8 and officially revealed their work for the first time in 2010 9 . In the same year, the project went from the compiler initially used (written in OCaml ) to the self-hosted compiler written in Rust 10 . This compiler, known as rustc , was successfully compiled in 2011 11 . The self-hosted compiler uses LLVM for its Backend .

The first alpha numbered version of the Rust compiler appears in January 2012 12 .

Because of Mozilla 13’s policy , Rust is fully developed in an open manner (Mozilla Research engineers publish their ideas and decisions made at meetings) and solicits comments and contributions from the community. The language design is gradually improved through feedback from the team working on the Servo 14 renderer and pragmatically when writing the compiler. Although the project is funded by Mozilla and Samsung, most of the contributions come from the community.

Description

The goal of Rust is to become an effective language for the creation of large client software and Internet-based servers. This goal has led to the integration of features enhancing security, memory control and competition. The performance of the Rust code in security mode tends to be less than that of the C ++ code if the said performances are the only considerations. However, when comparing with a C ++ code that manually uses the same security precautions as Rust, performance is comparable.

The language syntax is similar to C , consisting of blocks of code delimited by braces and control structures such as if, else, whileand for. All C keywords are not reserved by the language, however, and certain forms specific to functional languages, such as blocks matchallowing pattern- based filtering, might confuse developers arriving from strictly imperative or object-oriented languages. Thus, despite their syntactic resemblance, Rust is semantically very different from C or C ++.

In particular, the system has been designed to guarantee the deallocation of memory. Thus, it does not allow, for example, the pointers nullor even references to the already de-allocated memory. Variables can only be initialized by a limited number of forms, all requiring variables to be initialized before use. A lifetime system and freeze pointers allows the compiler to prevent several types of common errors in C ++, even when using smart pointers .

Highlights

Rust is based on known and proven concepts (hence the name Rust , “rust” in English) and does not incorporate new concepts and untested 15 . These concepts have been borrowed from existing programming languages ​​and assembled in a single language 16 :

  • Low-level orientation , with the possibility to choose the memory management adapted to the program: stack , heap ( unique_ptr , shared_ptr );
  • management competition built into the language;
  • Safe by default, with the ability to bypass this security in unsafe blocks :
    • Static typing without implicit conversions,
    • Memory accesses statically enabled by the compiler ,
    • Variables immutable by default,
    • Passing messages between competing tasks to avoid errors related to competing access to the memory;
  • Inference of types ;
  • Filtering by pattern ;
  • Genericity .

Rust is often described as one of the potential successors of C ++ (with D and, to a lesser extent, Go ) especially because of its security – this is a goal clearly displayed by developers.

Rust-Based Projects

  • Firefox 17
  • Servo : HTML rendering engine
  • Magic Pocket: Distributed storage system from Dropbox. 18
  • RedoxOS

Code examples

Hello world :

Fn main () { println ! ( "Hello World!" ); }

References

  • ( In ) This article is partially or entirely from the article in English entitled ” Rust (programming language) ” ( see the list of authors ) .
  1. ↑ https://blog.rust-lang.org/2017/02/02/Rust-1.15.html  [ archive ]
  2. ↑ https://mail.mozilla.org/pipermail/rust-dev/2012-January/001256.html  [ archive ]
  3. ↑ https://github.com/rust-lang/rust/blob/master/COPYRIGHT  [ archive ]
  4. ↑ https://github.com/rust-lang/rust/blob/master/COPYRIGHT  [ archive ]
  5. ↑ ( in ) ” The Rust Language [ archive ] , Lambda the Ultimate, (Accessed 30 October 2010 ) .
  6. ↑ ( in ) ” The Rust Programming Language [ archive ] (accessed 21 October 2012 ) .
  7. ↑ ( en ) « Doc language FAQ »  [ archive ] (accessed 21 October 2012 ) .
  8. ↑ ( en ) ” Project FAQ [ archive ] , (Accessed January 11, 2012 ) .
  9. ↑ ( en ) ” Future Tense [ archive ] , (Accessed February 6, 2012 ) : ” At Mozilla Summit 2010, we launched Rust, a new programming language motivated by safety and concurrency for parallel hardware, the” manycore “future which is upon us.  “
  10. ↑ ( in ) Graydon Hoare , ” Rust Progress [ archive ] , (Accessed 30 October 2010 ) .
  11. ↑ ( in ) Graydon Hoare , ” [rust-dev] stage1 / rustc builds [ archive ] , (Accessed April 20, 2011 ) :”  After that last change fixing the logging scope context bug, looks like stage1 / rustc builds. Just shy of midnight 🙂 “.
  12. ↑ ( in ) catamorphism, ” Mozilla and the community release Rust Rust 0.1 (a strongly-typed systems programming language with a focus on safety and concurrency memory) [ archive ] , (Accessed 6 February 2012 ) .
  13. ↑ ( en ) ” The Mozilla Manifesto [ archive ] (accessed April 9, 2012 ) .
  14. ↑ ( in ) Peter Bright, ” Samsung teams up with Mozilla to build browser engine for multicore machine [ archive ] , (Accessed4 April 2013 ) .
  15. ↑ ” Presentation of Rust on Lea-Linux [ archive ] (accessed December 11, 2013 ) .
  16. ↑ ” Exit Rust 0.8 [ archive ] (accessed October 15, 2013 ) .
  17. ↑ ” Shipping Rust in Firefox ★ Mozilla Hacks – the web developer blog [ archive ] , on hacks.mozilla.org (accessed October 19, 2016 )
  18. ↑ ( in ) Cade Metz , ” The Epic Story of Dropbox’s Exodus From the Amazon Cloud Empire ” , WIRED , ( Read online  [archive ] )