|
Rust is a general-purpose, multi-paradigm, compiled programming language developed by Mozilla Research. It is designed to be a "safe, concurrent, practical language",〔(【引用サイトリンク】title=The Rust Programming Language )〕〔(【引用サイトリンク】title=Doc language FAQ )〕 supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles. The language grew out of a personal project by Mozilla employee Graydon Hoare. Mozilla began sponsoring the project in 2009〔(【引用サイトリンク】title=Project FAQ )〕 and announced it in 2010. The same year, work shifted from the initial compiler (written in OCaml) to the self-hosting compiler written in Rust. Known as ''rustc'', it successfully compiled itself in 2011. rustc uses LLVM as its back end. The first numbered pre-alpha release of the Rust compiler occurred in January 2012. Rust 1.0, the first stable release, was released on May 15, 2015.〔 Although its development is sponsored by Mozilla, it is an open community project. The design of the language has been refined through the experiences of writing the Servo web browser layout engine and the Rust compiler. A large portion of current commits are from community members. The language takes its name from the rust family of fungi. == Design == The goal of Rust is to be a good language for creating highly concurrent and highly safe systems. This has led to a feature set with an emphasis on safety, control of memory layout, and concurrency. Performance of safe code is expected to be slower than C++. However, performance is comparable to C++ code that manually takes precautions. The syntax of Rust is similar to C and C++, with blocks of code delimited by curly brackets, and control flow keywords such as if , else , while , and for . Not all C or C++ keywords are present, however, while others (such as the match keyword for multi-directional branching, similar to switch in other languages) will be less familiar to programmers coming from these languages. Despite the syntactic resemblance, Rust is semantically very different from C and C++.The system is designed to be memory safe, and it does not permit null pointers or dangling pointers. Data values can only be initialized through a fixed set of forms, all of which require their inputs to be already initialized.〔(【引用サイトリンク】title=Doc language FAQ )〕 A system of pointer lifetimes and freezing allows the compiler to prevent many types of errors that are possible to write in C++, even when using its smart pointers. The type system supports a mechanism similar to type classes, called 'traits', inspired directly by the Haskell language. This is a facility for ad-hoc polymorphism, achieved by adding constraints to type variable declarations. Other features from Haskell, such as higher-kinded polymorphism, are not yet supported. Rust does not use an automated garbage collection system like those used by Java or .Net. 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. Functions can be given generic parameters but they must be explicitly bounded by traits. There is no way to leave off type signatures while still making use of methods and operators on the parameters.The object system within Rust is based around implementations, traits and structured types. Implementations fulfill a role similar to that of classes within other languages, and are defined with the impl keyword. Inheritance and polymorphism are provided by traits; they allow methods to be defined and mixed in to implementations. Structured types are used to define fields. Implementations and traits cannot define fields themselves, and only traits can provide inheritance, in order to prevent the diamond inheritance problem of C++.抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Rust (programming language)」の詳細全文を読む スポンサード リンク
|