Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Mozilla

Rust 1.31 Released As 'Rust 2018' In Major Push For Backwards Compatibility (rust-lang.org) 81

"The Rust programming language team has announced the first major edition of Rust since 1.0 was released in 2015," reports SD Times -- specifically, Rust 1.31, the first edition of "Rust 2018," described by Rust's developers as "the culmination of feature stabilization."

An anonymous reader writes: The Rust team is working hard to maintain backwards compatibility, for example with the way they're handling the ongoing addition of an async/await feature. "Even though the feature hasn't landed yet, the keywords are now reserved," notes the Rust Team. "All of the breaking changes needed for the next three years of development (like adding new keywords) are being made in one go, in Rust 1.31." The keyword "try" has now also been reserved, but "Almost all of the new features are 100% compatible with Rust as it is. They don't require any breaking changes... New versions of the compiler will continue to support "Rust 2015 mode", which is what you get by default... [Y]ou could think of Rust 2018 as the specifier in Cargo.toml that you use to enable the handful of features that require breaking changes."

The Rust language's blog adds, "Your 2018 project can use 2015 dependencies, and a 2015 project can use 2018 dependencies. This ensures that we don't split the ecosystem, and all of these new things are opt-in, preserving compatibility for existing code. Furthermore, when you do choose to migrate Rust 2015 code to Rust 2018, the changes can be made automatically, via cargo fix." Tooling improvements include faster and smarter "incremental" compilation (along with better IDE support), plus the addition of function-like and attribute-like (procedural) macros. There's also a rustfmt tool which can automatically reformat your code's style "like clang format does for C++ and Prettier does for JavaScript," plus an optional diagnostics linter named clippy, and automated code fixes via rustfix. There's even upgrades to Rust's module system and other path clarity improvements.

But this is only the beginning, SD Times reports: With the release of Rust 2018, the team is now starting to look at Rust's future. The team is asking developers to reflect on what they liked, didn't like or hoped to see in Rust during the last year, and propose any goals or directions for the upcoming year.
This discussion has been archived. No new comments can be posted.

Rust 1.31 Released As 'Rust 2018' In Major Push For Backwards Compatibility

Comments Filter:
  • Seems like every language is making backwards incomparable changes. I guess after Python 3, everyone thinks backwards incompatible changes are ok, even though Perl6 was DOA. Every version of Swift is backwards incompatible, Tensorflow 2 totally incompatible with 1.x, and these days even Java is doing it with backwards incompatible changes involving JavaFX and some other libraries. I want to like Swift, but having all your code break every 12 months is getting old. You won't be replacing C/C++ if you break e

    • by alexo ( 9335 )

      Seems like every language is making backwards incomparable changes.
      [snip]
      You won't be replacing C/C++ if you break everyone's code every 18 months.

      C and C++ are different languages. While C++ is mostly a superset of C99, and there was some cross-pollination of features between them since, there are enough idiomatic differences between them to make "C/C++" meaningless, unless you refer to "writing C style code while using some C++ features" (a.k.a "C with classes"), which, IMHO, is not a good choice of programming style in most cases.

      Regardless, both C an C++ try to be backward compatible in their corresponding revisions, and most breaking changes fal

      • by Anonymous Coward

        C++ is mostly a superset of C99 ...

        Not even close. The const operator is the biggest difference
        between the two languages. C++ is not an improved C language.

        Arrays and compound literals are handled differently; some integer
        math is different; variable promotion is not intuitive nor intrinsic;
        there's no simplified cast in C++, it's a tangled web of nutty cast
        operators to perform a straightforward task. That's the short list, too.

        Also, I have 20-year old C code that compiles and runs today. I
        have 20-year old

        • by alexo ( 9335 )

          C++ is mostly a superset of C99 ...

          Not even close. The const operator is the biggest difference
          between the two languages. C++ is not an improved C language.

          Arrays and compound literals are handled differently; some integer
          math is different; variable promotion is not intuitive nor intrinsic;
          there's no simplified cast in C++, it's a tangled web of nutty cast
          operators to perform a straightforward task. That's the short list, too.

          Also, I have 20-year old C code that compiles and runs today. I
          have 20-year old C++ code that crashes and burns under modern
          compilers (when it ran fine in it's day, like molasses, but ran).

          1. Ugh, typo! I meant C89, not C99. My bad. That said, I do not claim that C++ is a strict superset of C89, only "mostly", but I don't see it as a problem because they are different languages. C programs should be compiled with C compilers.

          2. C++ has always supported C-style casts.

          3. Conformant C++98 code should work the same when compiled under compilers conforming to newer versions of the standard. Other than the obvious cases of adding keywords and deprecating auto_ptr, I would be interested to see

      • by alexo ( 9335 )

        C and C++ are different languages. While C++ is mostly a superset of C99

        Sorry, I meant to type C89. Thank you AC!

    • Swift has said that at this point they plan not to introduce source breaking changes again (I think there may be one more they were strongly considering).

      As someone who has been using Swift professional since the start, I really do not care though. Partly that is because of migration tools helping, but in large part it's because I'll probably be using Swift for 10 more years at least, so I'd WAY rather have the language be better to work in for a decade or longer, then complain just because I had to spend

    • Noobs never understand backwards compatibility: a product's user base will abandon it if it abandons backwards compatibility. Get a reputation for not maintaining backwards compatibility, and the product won't gain significant new users. And every non-backwards compatible change will drive away more and more users.

      Nobody with a real job wants to have to redo their work just because you have the attention span and planning ability of a baby squirrel who stole a pot of espresso.

  • by Anonymous Coward

    Rust is just another ruby. It will die out in a couple years for the next programming language fad.

  • I hope it is better than the cluster that is async/await in Python. I am not sure how you have a new language in 2018 though that doesn't have concurrency built in. It is understandable for Python, but not Rust.
    • I hope it is better than the cluster that is async/await in Python. I am not sure how you have a new language in 2018 though that doesn't have concurrency built in. It is understandable for Python, but not Rust.

      That didn't call it 'cluster' without a good reason.

  • There are a few aspects of Rust that I like, but there are more things that I dislike about it, and I'm afraid async/await is another thing I would probably dislike. I looked over some of the reasoning behind it, and I'm frankly not finding particularly solid reasons for it. OTOH, Go's several different ways of handling concurrency are much easier to grok and "get stuff done".
    • by serviscope_minor ( 664417 ) on Saturday December 08, 2018 @01:09PM (#57771296) Journal

      OTOH, Go's several different ways of handling concurrency are much easier to grok and "get stuff done".

      Well yes. But that's the problem. It's easier to hack stuff out in go because when it comes to threading it doesn't do much to stop you shooting yourself in the foot. Pretty much the entire reason for the existence of Rust was to enable the moz devs to write fine grained multithreaded code without creating a nest of subtle threading bugs.

      The reason it looks harder in Rust is because writing correct multithreaded code is in fact hard. Annoyingly so.

      • > It's easier to hack stuff out in Go because when it comes to threading it doesn't do much to stop you shooting yourself in the foot. ...
        > The reason it looks harder in Rust is because writing correct multithreaded code is in fact hard. Annoyingly so.

        Well put. I'm not a Rust fan, not even know much about it other than that Rust fans have done some over-the-top hype about features most other languages have too. I'm dealing with a codebase that has a lot of concurrency problems though. The languages

      • by djbckr ( 673156 )
        Well, I never said that writing concurrent/multithreaded apps is easy. But the features in Go make it a lot more palatable. You still have to be aware what's running concurrently.
    • I am enamored with Jai's approach of pulling everything into the the source - the code, build stuff, test etc. I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

      I want to like rust - It has great security properties - but it's so ugly.

      • I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

        I'm questioning your results. Here are the step to create and run Hello World:

        cargo new hello
        cd hello
        cargo run

        That's it. 11 seconds start-to-finish, including fixing a typing mistake.

        • I tried the new rust command line tutorial and it created a directory with multiple files before I ever got to write a line of code. importing a library needed two files with different syntaxes. It took a long time to compile Hello World.

          I'm questioning your results. Here are the step to create and run Hello World:

          cargo new hello

          cd hello

          cargo run

          That's it. 11 seconds start-to-finish, including fixing a typing mistake.

          Look in the directory.
          Cargo created a directory with some files in it and two sub directories with files in them.
          You cd into that directory and 'cargo run' it, which both builds and runs it. The build takes a long time (compared say to gcc, which completes pretty much instantly).
          To follow the command line tutorial I can had to edit a .toml file to declare a library dependency and edit the rust source file to do the import of the library.

          Quite a lot for hello world.

          • I specified the commands needed to create, build, and *run* the Hello, World program. Note, that Hello, World is the default program that is created for you when you type "cargo new", so you don't even have to edit it. 11 seconds. Try it just like I typed it.
  • by Anonymous Coward

    Sounds like a tune from Judas Priest, the heavy metal gods of folk.

  • by RoccamOccam ( 953524 ) on Saturday December 08, 2018 @02:41PM (#57771636)
    I'm about 6 months in to seriously using Rust and I absolutely love it! The ecosystem is fantastic (cargo and crates.io), the zero-cost, high-level abstractions are great, and the borrow checker is amazing!
  • Why I love Rust (Score:4, Informative)

    by dremon ( 735466 ) on Saturday December 08, 2018 @03:25PM (#57771802)
    I've been lucky to persuade our PM to give Rust a try. Our main server product is written in Scala and now it also includes several Rust components which I develop and maintain. What a difference it makes! As a pro developer with decades of experience in Java/C/C++ I fully embrace it.

    Learning curve is quite steep, yes, due to unusual concepts (mainly borrow checker and move semantics). Once you get past struggling with that everything clicks in it's place and coding becomes fun again, way more so than in C/C++.

    My bullet points why I like it so much:
    • Great compiler/tooling design, cargo build tool, rustup compiler management, crates.io central repository
    • Amazing built-in unit test support, it's SO easy to write unit tests next to your production code and they are not included into the production build!
    • Very modern language features: traits, higher-order functions, closures, iterators, generics, threads, very good standard library, great external asynchronous modules which are being added now to stdlib
    • It's hard to make a messy design with sea of objects, compiler kind of enforces you to think over relations
    • No data inheritance
    • Great module system, which just became even better with 2018 edition
    • Safety, safety, safety. It's next to impossible to shoot yourself in the leg unless you do unsafe code (which is normally localized to few source locations for few special cases)
    • Fast growing collection of crates (modules), I think the intrinsic safety of the language makes them in general more stable than 3rd-party stuff written for example in Java
    • Semantic versioning, no jar hell
    • Consistent tooling, no freakin' sea of hundred build tools (cmake/make/nmake/meson/autotools/msbuild/whatever_stuff_of_the_day) and no manually managed external dependencies
    • Working IDE support, although not as polished as for Java, the IntelliJ and VSCode/RLS are working ok, especially IntelliJ
    • Very easy to integrate with existing C/C++ code via FFI, which is one of the design goals
    • No runtime and no dependencies for the target executable
    • No garbage collection, fine control over heap/stack allocations, runs blazingly fast
    • Easy to do cross compilation
    • Based on LLVM, supports all major targets
    • by tepples ( 727027 )

      No runtime and no dependencies for the target executable

      This is because everything is statically linked. For example, last time I built the release build of the driver to load games onto a USB RAM cartridge for the Game Boy [github.com], it pulled in enough crates to total 6,787,656 bytes of executable code. How would this integrate with the UNIX philosophy's rule of composition [wikipedia.org], where a task consists of a half dozen or more different processes? Would all the processes have to be built into one executable that uses the executable's name to determine which sub-program to run?

      • by dremon ( 735466 )
        Static linking is a default option but you can also link dynamically and deploy with a bunch of dependent DLLs/SOs if you want.
  • Did this game ever really take off? Why are people still talking about it?

If all else fails, lower your standards.

Working...