Announcement

Collapse
No announcement yet.

Mozilla Updates To Rust 0.9 Programming Language

Collapse
X
  • 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.

    Comment


    • #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.

      Comment


      • #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.

        Comment


        • #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.

          Comment


          • #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.

            Comment


            • #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.

              Comment


              • #37
                Oops, I should've used google first. Here:
                http://togototo.wordpress.com/2013/0...la-and-nimrod/

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

                Comment


                • #38
                  Originally posted by profoundWHALE View Post
                  Oops, I should've used google first. Here:
                  http://togototo.wordpress.com/2013/0...la-and-nimrod/

                  It's only one benchmark of one program, but it gives a good idea as to the performance.
                  Another bench. http://attractivechaos.wordpress.com...udoku-solving/

                  Comment


                  • #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.

                    Comment


                    • #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 :
                      Code:
                       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.

                      Comment


                      • #41
                        Originally posted by cmr~ View Post
                        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.
                        If code that looks like C can be compiled by dmd, then it should behave like C.

                        But D is not a drop-in replacement for C and indeed is more like C++ (in fact it got even worse over time…)

                        Personally I don’t like what I’ve seen about the Rust syntax, D v2 sucks for being too complicated, and Go is great but lacks official bindings for many libraries…
                        Last edited by stqn; 01-10-2014, 09:36 PM.

                        Comment


                        • #42
                          Originally posted by cmr~ View Post
                          That's uninteresting because of the memory safety problems inherent in the languages. What purpose would there be for a language exactly like C except for ... what? What would you change? The syntax? That's not a compelling reason to switch languages, even if it's a mechanical transformation. C++ is far too complex to even possibly recreate.
                          What? Lots, I'm not even gonna try to make a list of issues, just think how much could be removed, moved or changed if a clean break was an option.
                          A quick random list: remove std::string, exceptions etc from C++, put a utf8 string, threads, sized ints (e.g. uint32_t) etc in the core language, stuff like proper pragma_once, and lots lots more, yet, unlike Vala, Go and D, stay C/C++-like, not Python-like. Design them to depend less on macros.

                          Comment


                          • #43
                            I tried Rust, but it is far too complex for my taste. If you are making programming language to replace C++ (what i think Rust is trying) you should make that language simpler so switch would be less painful.
                            For example, rust has 3 types of pointers (if i counted that correctly) and the first topic in tutorial about pointers is You don't actually need pointers. Than why did you make 3 types!?!?
                            And about tricks you can do with semicolons: it maybe saves you from typing couple of characters, but greatly decreases code readability.
                            I really wanted to like rust, but it just failed for me, maybe i didn't give it enough time. I still hope for all 3 new programming languages (D, Go and Rust) to succeed, so I (or maybe my children) can forget about C++.

                            Comment


                            • #44
                              I tried Rust, but it is far too complex for my taste. If you are making programming language to replace C++ (what i think Rust is trying) you should make that language simpler so switch would be less painful.

                              For example, rust has 3 types of pointers (if i counted that correctly) and the first topic in tutorial about pointers is called You don't actually need pointers. Than why did you make 3 types!?!?
                              And about tricks you can do with semicolons: it maybe saves you from typing couple of characters, but greatly decreases code readability.

                              I really wanted to like rust, but it just failed for me. Maybe i didn't give it enough time. I still hope for all 3 new programming languages (D, Go and Rust) to succeed, so I (or maybe my children) can forget about C++.

                              Comment


                              • #45
                                Originally posted by Temlar View Post
                                I tried Rust, but it is far too complex for my taste. If you are making programming language to replace C++ (what i think Rust is trying) you should make that language simpler so switch would be less painful.

                                For example, rust has 3 types of pointers (if i counted that correctly) and the first topic in tutorial about pointers is called You don't actually need pointers. Than why did you make 3 types!?!?
                                And about tricks you can do with semicolons: it maybe saves you from typing couple of characters, but greatly decreases code readability.

                                I really wanted to like rust, but it just failed for me. Maybe i didn't give it enough time. I still hope for all 3 new programming languages (D, Go and Rust) to succeed, so I (or maybe my children) can forget about C++.
                                D is far more complex then rust. Rust is actually quite simpler then C++ IMO.

                                As for 3 types of pointers. Well raw pointers are simply pointers without any safety (like pointers in C, same * operator). They are generally discouraged and only there for low level/performance critical code and interoperability with code in other languages. There are then managed pointers and owning pointers. Most people use owning. So much so that managed pointers were removed out of the language and into the standard library, so you need to explicitly ask for them.
                                See: http://static.rust-lang.org/doc/0.9/...#pointer-types

                                Comment

                                Working...
                                X