Rust (programming language)
Encyclopedia
Rust is an experimental, concurrent, multi-paradigm
Multi-paradigm programming language
Programming languages can be grouped by the number and types of paradigms supported.-Paradigm summaries:A concise reference for the programming paradigms listed in this article....

, compiled
Compiled language
A compiled language is a programming language whose implementations are typically compilers , and not interpreters ....

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 developed by Mozilla Labs. It is designed to be practical, supporting pure-functional
Purely functional
Purely functional is a term in computing used to describe algorithms, data structures or programming languages that exclude destructive modifications...

, concurrent-actor
Actor model
In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and...

, imperative-procedural
Procedural programming
Procedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...

, and object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 styles.

The main developer is Graydon Hoare, who began work on the system in 2006; Mozilla became involved in 2009. In 2010, work shifted from the initial compiler, written in OCaml, to the self-hosted compiler written in Rust itself. It successfully compiled itself the following year. The self-hosted compiler uses LLVM
Low Level Virtual Machine
The Low Level Virtual Machine is a compiler infrastructure written in C++ that is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages...

 as its backend.

To emphasize the experimental nature of the language, the Rust wiki clearly states: “This is a very preliminary work in progress. No supported releases yet nor defined release schedule/plans. Caveat emptor. It will crash. It will change syntax and semantics. It will eat your laundry. Use at your own risk. Etc.”

Description

The goal of Rust is to be a good language for the creation of large client and server programs that run over the Internet. This has led to a feature set with an emphasis on safety, control over memory layout and concurrency. Performance should be comparable to idiomatic C++.

Rust intentionally does not include any novel or untested ideas. The project aims to collect the best features of already-created, old languages, and package them into a useful, practical package.

The syntax of Rust is similar to C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 and C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

, with blocks of code delimited by curly braces, and control-flow keywords such as if, else, do, while, and for. Not all C or C++ keywords are present, however, while others (such as the alt statement for multi-directional branching) will be less familiar to programmers coming from these languages. The syntax of Rust is effectively frozen while the semantics of the language takes priority.

The system is designed to be memory safe, and it does not permit null pointers or dangling pointer
Dangling pointer
Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. These are special cases of memory safety violations....

s. Data values can only be initialized through a fixed set of forms, all of which require their inputs to be already initialized.

In addition to conventional static typing, Rust supports typestates. The typestate system models assertions before and after program statements, through use of a special check statement. Any discrepancies can be discovered at compile time, rather than once a program is running, as might be the case with assertions
Assertion (computing)
In computer programming, an assertion is a predicate placed in a program to indicate that the developer thinks that the predicate is always true at that place.For example, the following code contains two assertions:...

in C or C++ code. The typestate concept is not new, first being introduced in the NIL programming language.

Rust features type inference, for variables declared with the let keyword. Such variables do not require a value to be initially assigned in order to determine their type. A compile-time error results if any branch of code fails to assign a value to the variable. Type inference does not apply to variables declared within the signature of a function; for example fn fib(n: int) -> int { } cannot be shortened to fn fib(n) -> { }.

Criticism

Early in its development, Rust prohibited the use of non-ASCII characters in identifiers. A language FAQ argued that in practice most non-English-using programmers used ASCII identifiers for naming variables and functions; however, the limitation drew criticism. A language change in February 2011 removed this restriction.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK