Slashdot Mirror


Rust 1.6 Released (rust-lang.org)

An anonymous reader writes: The Rust team has announced the release of version 1.6 of their programming language. The biggest new feature is that libcore — the Rust core library — is now stable. "Rust's standard library is two-tiered: there's a small core library, libcore, and the full standard library, libstd, that builds on top of it. libcore is completely platform agnostic, and requires only a handful of external symbols to be defined. Rust's libstd builds on top of libcore, adding support for memory allocation, I/O, and concurrency. Applications using Rust in the embedded space, as well as those writing operating systems, often eschew libstd, using only libcore." Other features worth noting: Crates.io disallows wildcards for dependencies, there are a ton of stabilized APIs, timer functions that use milliseconds have been deprecated, and the parser will warn you if a failure was caused by Unicode characters that look similar but are interpreted differently.

2 of 75 comments (clear)

  1. Re: WTF? by Jezral · · Score: 3, Informative

    Depends on what you mean by fail, but nothing new ever really beats C++. Sure fancy new languages keep popping up with features, but it either lacks portability or performance or control or higher level constructs or reliability or something else that C++ can provide. And eventually C++ gains the language feature anyway, but without sacrificing efficiency for it. Many languages have tried to take C++'s place, but so far none have gotten close. And even where other languages have a good hold (Java, C#, ObjC, etc), when you want an efficient library shared between those ecosystems, you'll write that in C++.

    And no, C doesn't really count in the comparison, because it doesn't grow - while WG14 publishes new standards, it's still mostly C89 used in the wild, with a few extensions.

  2. Re: WTF? by NotInHere · · Score: 2, Informative

    And eventually C++ gains the language feature anyway, but without sacrificing efficiency for it.

    Yes, C++ is a great language if its about which language contains the most features. But one thing which is very bad about c++ is that its very easy to write a bad program. In rust its very hard to write a bad program, as you first have to convince the compiler (including the borrow checker) to compile it, which requires you to think about what works how. Also, rust forbids things it considers "unsafe" by default, while with C++ you still can do very unsafe things.

    C++ is great because its backwards compatible to C. You press a button and a C project is now a C++ project. So many people familiar with C could also try C++. However, as rust doesn't have to provide backwards compat, it can do many things more nice than C did. For example, you don't need to do the #if 0 trick anymore if you want to comment a block of code. So this for example would compile "code" in C++ but wouldn't compile anything in rust: /**/ comments: /* /*comment explaining code*/ code */

    The second thing that rust can add which C++ can never achieve is the improved safety. C++ can't add additional requirements to C, including security. It can't prevent usage of non-smart pointers. And if you want to move a project from using normal pointers to smart pointers, you have to rewrite it anyway.

    There are more things rust is better in than C++:

    * most C++ projects have to deal with numbers sooner or later. But even if everybody praises c++ as portable and so on, its still a common pitfall for projects to assume that char (which is an integer number containing one byte) is 8 bits. And different platforms can have different widths for the other types too, the bounds were specified too broadly by the previous standards, and now nobody wants to touch it anymore. And yes, there is uint16_t etc introduced by c++11, but they are long, and hard to type. I prefer to edit my code without having to use an IDE.

    * Rust's type system is an actual type system. You can return tuples and do more stuff. Everything that's verified compile time comes at run-time for free. So where you need to add an assert in C++, you can simply code a type which does the same thing in rust, without much boilerplate you would have needed in c++.

    * If you pass a mutable reference to an object to a function, you have to prepend &mut to the object's name when calling the function. This hasn't been required by the C++ developers when they introduced references, their first failed attempt to replace pointers.

    * Rust is less portable than C++, that's true, it doesn't run on all hardware platforms C++ runs on, but it runs on the most relevant ones.

    And no, C doesn't really count in the comparison, because it doesn't grow - while WG14 publishes new standards, it's still mostly C89 used in the wild, with a few extensions.

    C is a finished language, you can't really add anything significant to it unless you want to sacrifice its core properties.