Settings

Theme

Announcing Rust 1.12.1

blog.rust-lang.org

176 points by silluk 9 years ago · 29 comments

Reader

deckiedan 9 years ago

This is really cool, actually. And the reason I think it's actually good to be high on HN, not just the 'ooooh rust, upvote derp!' is this:

This is a point release that they don't need to do - on the grounds that it's not a bad time to do one, but it should help in the future to do point releases quickly if there is a real need to (security, etc).

There's a commitment in the rust team to making life really really good for developers, and I appreciate that a lot.

bluejekyll 9 years ago

I have Travis builds against nightly, beta and stable on Linux and Mac. I have to say, with the exception of OpenSSL breaking on Mac recently (fixed with OpenSSL 0.8), I haven't had a compiler failure or bug introduced in any of my tests in the time since 1.0 (at least I can't remember one).

Even these, which obviously effected others, didn't effect my code. Cudos to the Rust team for being on top of this!

  • kibwen 9 years ago

    Not even on nightly? I know that we don't tend to mess with things unless they're behind unstable feature flags (which you presumably aren't using), but I'd be very pleasantly surprised if we managed to make nightly stable enough that you never happened to run into any compiler bugs. :)

    • bluejekyll 9 years ago

      So I have 20,292 lines of Rust with 85%ish code coverage in my project (by current count), and I can't recall a failure in nightly since I enabled it in Travis. Mind you, that only gets run when a commit happens, so it's entirely possible it could have failed and I've just been lucky. It looks like from git log, I committed the change to Travis to start nightly builds on

        Date:   Sat Aug 22 11:45:08 2015 -0700
      
      So, take that for what it's worth :)
laxentasken 9 years ago

Question for you guys: I'm planning to putting down some time into learning java for the higher stuff along with C the coming year. I know the very basics of C and java, but after looking into the documentation for rust I got that feeling of "oh man, this really looks fun to get into."

Is Rust "mature" enough to start to dabble with and actually put down some hours into (and thus replace C in my plan)? Only hobby projects so far.

  • biokoda 9 years ago

    For higher level stuff Erlang/Elixir is a much better option. Productivity will be way higher.

    For lower level stuff Rust is a better option. Better productivity, equal performance, much higher safety.

    Unless you have specific needs that require Java/C of course.

    • laxentasken 9 years ago

      I see, thank you! The reason for java was mostly because I had prior albeit small experience, and the way the job market looks.

      • dbrgn 9 years ago

        Java probably still has a long future ahead, especially because Android app dev is done in Java. There are also lots of jobs around.

        On the other hand, a lot of Java jobs involve stuff like enterprise Java, which can be horrible to work with.

        C is probably good to know, so I'd play around with it for a few weeks and then move on to Rust. Knowing C probably lets you appreciate Rust even more.

        Java is also good to know and not hard to get into. But for hobby projects I'd choose something else, unless you want to do Android apps.

        Edit: Python is also a great all-round high level language and there are many Python jobs around :)

rfrey 9 years ago

The two imaginary futures I daydream about where performance is a concern are robotics and serious AI algorithms (RL especially). I'd assumed I'd need serious C (or C++) chops for the embedded development of the first, and real access to GPU parallelism for the second.

Does anybody have experiences to share using Rust like this?

  • pYQAJ6Zm 9 years ago

    No direct experience here, but I know there is Vulkano[1], a Rust library that wraps around the Vulkan API. But until (and if) a SPIR-V target is available to the Rust compiler, the compute shaders will still have to be programmed in another language (typically, GLSL). This covers the GPU side of your interest.

    I don’t know how things stand in the embedded Rust camp, however.

    [1] https://github.com/tomaka/vulkano

sdegutis 9 years ago

Honest question from a non C++ developer: what's the main point of Rust? What's the primary reason for choosing it over any other language? When would it be most appropriate to choose?

  • wcrichton 9 years ago

    Rust is a replacement for C++. It is meant to be a modern, general-purpose systems language, where "systems" generally means anywhere you need to be close to the metal. This includes areas like embedded systems and high performance computing. Modern means it has features and tooling you expect from languages in 2016. For example, on a language level, Rust has type inference, sum types, pattern matching, proper generics, and a decent macro system. A modern language should also be memory safe, and Rust opts to ensure memory safety at compile time with the borrow checker (as opposed to runtime with a garbage collector like in most languages). As for tooling, it also has a proper package manager, which believe me, is incredible compared to handling dependencies in C++.

    So why would you choose Rust? If you need to use C++, because you need performance, or low-level access to memory, or any other reason, then you should choose Rust instead, because it's better for all the reasons listed above. The biggest strike against Rust compared to C++ is library support--people have been writing C++ and C libraries for decades, and Rust is a new language, so it won't have the same level of support.

    • bluejekyll 9 years ago

      While Rust is positioned firmly as an option in the same situations where C or C++ would be chosen, I'm personally of the opinion that it has a great potential of capturing use cases of higher-level languages as well, with the advent and work of Rust running on WebAssembly, it will become one of the first serious web client language alternatives to Javascript.

      It's partly because of the memory safety features. There have been quite a few people I've noticed coming from languages like Ruby and Javascript and being successful. Whereas I think C and/or C++ might have been more challenging, again b/c of memory safety (GC's are a lovely thing to rely on, until they get in your way). The compiler offers a huge advantage here, because while it is true that it is much more restrictive than other languages, it also almost guarantees that your code is correct.

      As an old C hack, with bad memories of C++, and a hater of the memory footprint of Java and the horribleness of the great GC pause; Rust has been a joy to learn and use. It's like bowling with the bumper rails up as an adult, and no one laughs at you (well, maybe they do, but you never throw a gutter ball!)

    • axonic 9 years ago

      Yes, what wcrichton said. Additionally, I have a suggestion. One of the deciding factors for me to fall in love with Rust was my habitual use of metaphor to distance my personal feelings from the issue at hand to reach an impartial decision. In this case, I suggest you replace "libraries" which may hold emotional significance for you with another concept of similar enough nature. Bias may also come from misperceptions, such as some inexperienced web devs feeling compelled to use jQuery to make everything, or naïve hobbyists thinking Arduino boards are the hammer for all nails.

      For the sake of hypothetical example, presume I have had a long history of involvement in some C++ libs which I associate with good times, hilarious IRC sessions, friends, and pouring love into the labor of creating them during 0300 caffeine overdoses. How could I possibly evaluate leaving this behind without such bias?

      Many choices are vulnerable to silly human biases which are hard to detect. Debating C++ versus Rust seems to be tough for some, and technical arguments have a propensity for becoming circular, so here's an analogy instead.

      - Imagine, (if you have no extreme attachments to the web) that we have created a new web with new protocols, software, hardware, solved most crypto issues, authentication is reliable, we created the safe and anonymous place of everyone's (some ppls) dreams. Most of the advances are wonderful and (mostly) fueled by the latest research and smart minds, but there are a few bugs. Overall, an improvement and well adopted but still needing polish. The problem? All the old content isn't there. Some amazing new experiences await, but reddit and youpn are not unless you pull up an old web browser. If you were tasked with creating new content, which web would you choose and why?

      I propose devs consider following either this, or some other method to evaluate C++ vs. Rust more objectively and try to set attachments aside. If, rather than thinking "but I won't have libX", you ask "how can I implement this functionality better today", you may decide that casting off old clutter is liberating and insightful.

      I hope this helps some of you.

    • zerofan 9 years ago

      If you think Rust is ready for high performance computing, I suspect you don't do HPC for a living and you haven't tried to do it with Rust. It's not just missing the needed libraries.

  • sidlls 9 years ago

    I suppose if I identified with any language, C++ would be it. I have the most knowledge and experience writing code in that language. I've been learning Rust lately and have written a few toys with it. I'll share my thoughts.

    1. The main benefit of Rust is its nearly cost-free safety guarantees. It's much harder to write code that is prone to UB with Rust than with C++. The comparison is almost silly, in fact, from that perspective. It comes with a runtime cost (e.g. drop flag checks, bounds/other memory access checks) in some cases, but for all cases other than those requiring even that last bit of performance this cost is tiny in comparison with the work the rest of the program is doing and well worth it in my opinion.

    2. The primary reason for choosing it over any other language is context dependent. This leads me to my last point.

    3. It would be fine to use for anything, really, but I think in the sense of "most appropriate" that you mean, it's "most appropriate" for systems programming that needs to be as fast as C++, but not necessarily melt-the-metal fast. Primarily this is because: a) it's as fast as C++ in almost all cases (and probably faster than equivalently-safe C++ in at least some cases) and b) it's much less likely I'll write code that smashes stacks, has data races, blows up memory or does a bunch of other crap that's trivial in C++ (or other languages). Even in cases where melt-the-metal fast is necessary it seems possible to do in Rust, but it just takes a lot of effort. That's deliberate on the part of the Rust developers, and it's difficult to argue against the reasoning behind it.

    Where Rust might really shine is helping a new generation of programmers write performant code that is safe without having to learn by trial-by-fire.

  • echelon 9 years ago

    I wrote a Donald Trump text to speech server in Rust. It's blazingly fast. If I'd written it in Python, it'd have taken seconds to generate audio. If I'd written it in C++, it'd likely have memleaked or segfaulted since I'm not skilled or patient enough to write safe C++.

    Rust is pretty much the coolest thing ever in my opinion. It's easy and fun to write. Cargo is the best package manager ever, and makes importing library code a breeze. I've never had multithreaded code warn me when I don't lock it correctly. It's so awesome.

    (wrt my Rust app, as soon as I load test and redesign the UI I'm going to share it on HN. It's pretty ridiculous and we have a lot of fun with it at work.)

    • anhnhoktvn 9 years ago

      Have you tried with Go?

      • echelon 9 years ago

        I'm honestly not a very big fan of Go. We use it at work and it just isn't something I want to come home and write. Different strokes, I guess.

        I'm sure that Go would have performance characteristics closer to Rust than Python would, but I'm almost certain Rust would still edge out Go.

        I'm getting to the point where I'm almost as productive in Rust as I would be in either other language, and that makes Rust a no-brainer for me.

      • orthecreedence 9 years ago

        I'd like to respond by this and saying I'm porting a largeish codebase over to Rust for one purpose: I can embed it other languages, and I can into it from any language that exposes an FFI.

        The goal is to move all business logic out of javascript on an nwjs desktop/crosswalk mobile app and move it to Rust. The interface would still be javascript, but the core logic (and crypto) would live in Rust. This gives me a portable core I can move between platforms, and in theory all that has to change is the UI (but not really, because in most cases the platforms run Javascript).

        I don't think Go can be as easily embedded (because of its runtime) but perhaps I'm wrong.

  • biokoda 9 years ago

    Compared to C++:

    - A fantastic package manager for your dependencies

    - Easy build system

    - A nicer language

    - Memory safe

    - Just as fast

    - A way stronger compiler that will prevent you from making mistakes that you can make in C/C++ very easily

    All in all more then enough benefits to make it worthwhile to switch unless there is a very good reason not to.

  • sigzero 9 years ago

    Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

    Featuring

      * zero-cost abstractions
      * move semantics
      * guaranteed memory safety
      * threads without data races
      * trait-based generics
      * pattern matching
      * type inference
      * minimal runtime
      * efficient C bindings
    
    That is from the Rust front page. HTH.
  • rkangel 9 years ago

    It's difficult to answer this question with 'one main reason'. Rust is what you get if you build a language that is intended to operate in the same space as C and C++, but benefits from the last 30 years of advances in programming languages.

    Some things that are better as a result of things that are hard to do right in C++:

    * Compiler monitors ownership of memory

    * Compiler monitors ownership across threads

    * Generics aren't handled as templates, and you can explicitly describe support using things like * trait bounds

    * Macros are useful but need to operate on something more like the AST rather than text tokens

    * A richer type system can help you express much more in the types (Rust enums)

  • Sagiri 9 years ago

    Rust is basically a safe C++, written by people who like functional languages. Also, it has an official package manager in Cargo, something that C++ lacks completely.

    As such, it targets essentially the same niche as C/C++.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection