Mozilla outlines a plan for Rust 1.0

    The Mozilla organization has reached the finish line in preparing the Rust 1.0 programming language. The developers say that this solemn event will take place around the end of the year. After beta testing, the final release will be released. From that moment on, a promising programming language can be used in combat conditions: the code is guaranteed to be compiled in future versions.

    It's not just about compilation. Mozilla believes that the Rust design is finally taking on the desired minimalistic shape. For example, before there were several types of pointers, now there are only &T, and &mut T. Simplification also affected other aspects, including closures, which caused a lot of controversy.

    Rust combines the power of C and C ++ with Java security.

    The whole design is built on the concept of ownership and borrowing. It was originally intended to use a ownership mechanism to quickly and securely transfer data between processes. But then came the understanding that the same mechanism can be used to transfer a significant part of functions to libraries. As a result, Rust turned out to be even lower level than the developers expected, and without compromising security. On a minimal Rust configuration, you can even write the kernel of the operating system (examples: 1 , 2 , 3 )!

    The developers also published a list of features that need to be implemented before the official release. Here's what the work is on now:

    • Types with dynamically sized types. The extension of the typing system allows the use of data types whose size is unknown at the time of compilation, for example, arrays. Instead, a dodgy pointer containing arrays or objects is affixed .
    • Unpacked circuit (unboxed closures). In the new closure design, they are combined with object types.
    • Associative types (associated types) in the system of signs greatly facilitate writing annotations for libraries, the first implementation is ready.
    • Where clauses. It is planned to introduce a flexible new form of elementary disjunction. Work on this function is already completed, it will soon be added to the main code branch.
    • A trait with multiple sending (multidispatch traits). Type functions are expanded so that they can specify more than one type at a time , this opens up possibilities for more ergonomic APIs and for using the associative types mentioned above.
    • Destructors . The semantics of destructors has been improved, so it no longer needs to zero out memory, which should increase the speed of compilation and execution of programs. Now the analysis of the conditions for zeroing the memory is ending, after which this part will also be added to the main branch.
    • Green threads (green threading) are removed from the main library to additional ones in order to optimize their efficiency on a specific operating system. This will also lead to faster execution of programs.

    In parallel, a Cargo package manager is created and a central software repository will be organized.

    From a lecture by Stepan Koltsov , which was recently published on Habré:

    “Rust solves Java and C ++ problems: programs written in Rust are both fast and safe. Rust is the same low-level (in the sense of close-to-metal) programming language as C ++, however, constructs are built into the language, allowing at the compilation stage to prove that the program does not happen memory errors, such as a double-call after use delete, use uninitialized memory, etc.

    In addition, Rust fixes many mistakes made in the design of C ++ and Java. For example, templates in Rust, unlike C ++, are statically typed, and instead of Java generics, a mechanism similar to Haskell typeclasses is used. ”

    See Rust official code examples on the official website .

    UPD Full translation of Googolplex 's article “Towards Rust 1.0”

    Also popular now: