No announcement yet.

Mozilla Updates To Rust 0.9 Programming Language

  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by mrugiero View Post
    I can't think in terms of Java, as I don't know Java. I do think I understood your explanation, anyway.
    It is pretty simple really. Normally when you would write Rust/C# code etc, you would get safe behavior by default the languages provide escape hatches if you want to do things a bit more low level and/or want tighter control.


    • #32
      Originally posted by profoundWHALE View Post
      I thought the point of D was to be a drop-in replacement for C, while at the same time being easier to code in. So all existing C code can just be compiled in D and all new code should be easier to maintain and develop.

      Am I right?
      No, you're entirely off. D is nothing like C. D is more like C++ in its capabilities, but the syntax is different etc etc etc etc etc. It's not backwards compatible with anything.


      • #33
        I think Rust could work quite well as C/C++ replacement or at least alternative, now that they dropped garbage collection (gc and refcounted pointers are provided by std lib).

        It has some nice stuff like traits(to implement interfaces), immutable variables by default, no raw pointers (well, not in safe code) and all the crap they bring with them.

        So it is like a more safe variant of C++ without the template metalanguage stuff (some might consider this a plus ).

        The only bit I personally am not thrilled about is the syntax, which on the first look seems like an amalgamation of a number of languages. But it gets the job done I guess. To quote Rust Reference Manual:
        Additional specific influences can be seen from the following languages:

        The structural algebraic types and compilation manager of SML.
        The attribute and assembly systems of C#.
        The references and deterministic destructor system of C++.
        The memory region systems of the ML Kit and Cyclone.
        The typeclass system of Haskell.
        The lexical identifier rule of Python.
        The block syntax of Ruby.


        • #34
          Originally posted by mrugiero View Post
          Well, rewriting the whole kernel just to switch language is a considerable task, for no short term benefit.

          I don't understand, didn't you just said it's memory safe, but still he got a triple fault? Are they unrelated? Or is just the port still uses some C and that was the origin of the fault?
          It was a bug in his task register handling code. Indeed, it was in an `unsafe` block. It's unrealistic to expect our safety mechanism to always be correct, and it's not possible to implement some things in it (for example, a reference-counted pointer). To that end we offer an `unsafe { ... }` that allows one to manipulate and dereference raw pointers.


          • #35
            Originally posted by Marc Driftmeyer View Post
            Rust will never replace C/C++. Get over it already. Make those languages meet your criteria through their standards specs.
            Impossible to do while retaining backwards compatibility. Besides, we can't add nice things like type classes, algebraic types and pattern matching. C only got "generics" to support porting fortran!

            Sure it probably won't replace C or C++. At least not for a looong time. But being a viable C or C++ replacement is a great goal. It's not like we don't know what we're doing; Rust is battle-forged from the pains of C++. Statically eliminating race conditions, iterator invalidation, and use-after-free is pretty cool.


            • #36
              What I would like is benchmarks against both C and C++ for it's would-be replacements, then have those benchmarked along with a list of each of their pros and cons. Because right now it's not a question of if C/C++ (and Java) will be replaced, it's a question of what with.


              • #37
                Oops, I should've used google first. Here:

                It's only one benchmark of one program, but it gives a good idea as to the performance.


                • #38
                  Originally posted by profoundWHALE View Post
                  Oops, I should've used google first. Here:

                  It's only one benchmark of one program, but it gives a good idea as to the performance.
                  Another bench.


                  • #39
                    I must say that the amount of performance that's come out of such young programming languages is amazing.

                    Rust is somewhere just over 1 year old
                    Go about 6 years old
                    D (version 2) about 6 years old
                    D (version 1) about 12 years old

                    Good work is being done.


                    • #40
                      Nothing will replace C for the Linux kernel. There's no reason to replace it, there's too much code in C already and there's just nothing out there that performs as well as C, not even C++.
                      Go is more like a python contender from what I understand so that leave C++ vs D vs Rust.
                      You can make programming languages but they also need to catch on. D hasn't and I doubt it will C# has because MS pushed it and well it's also probably pretty good ( I like it because it's easy to read C# code).
                      The only thing that I do hate with all my heart in Rust is variable declaration :
                       let price;
                      let monster_size: int = 50;
                      Seriously ? This reminds me of Basic or something even lamer. And this in a language ment to replace C++.

                      We'll see if Rust catches on but I for one don't thing C++ is that bad if you know how to program in C++. Give it some extensions like boost or Qt and it's almost as easy as higher level languages like C# and Java.