1. 39
  1.  

  2. 8

    Glad you liked TRPL! I agree that some of the examples can be too abstract at times, it’s tough. Totally open issues if you want to talk about it; I’m open to improving things, but I’m also pretty particular about the book.

    1. 1

      Glad to hear confirmation that the book is open to those kinds of suggestions :) And I can totally understand being particular about something like that, hopefully I’ll be able to offer some analogies that are up to snuff

    2. 4

      Nice article. How do you feel about the size of the language? One thing that keeps me off from looking at rust seriously is the feeling that it’s more of a C++ replacement (kitchen & sink) vs a C replacement.

      The Option example feels a bit dropped off too early, you started by showing an example that fails and then jumped to a different code snippet to show nicer compiler error messages without ever going back and showing how the error path is handled with the Option type.

      You should also add Ada to the list of your languages to explore, you will be surprised how many of the things you found nice or interesting were already done in the past (nice compiler errors, infinite loop semantics, very rich type system, high level language yet with full bare metal control).

      1. 2

        Thank you for commenting! I agree that Rust’s standard library feels as big as C++‘s, but I haven’t been too bothered by the size of either one. To quote Bjarne Stroustrup’s “Foundations of C++” paper, “C++ implementations obey the zero-overhead principle: What you don’t use, you don’t pay for [BS94]. And further: What you do use, you couldn’t hand code any better.” I haven’t personally noticed any drawbacks of having a larger standard library (aside from perhaps binary size constraints, but you would probably end up including a similar amount of code anyway, just code that you wrote yourself), and in addition to the performance of standards-grade implementations of common data structures, my take on it is that having a standardized interface to them improves readability quite a bit - when you go off to look through a codebase, the semantics of something like a hashmap shouldn’t be surprising. It’s a minor draw, but I feel like I have to learn a new hash map interface whenever I go off to grok a new C codebase.

        I’ll definitely take a look at Ada, seems like a very promising language. Do you have any recommendations for books? I think my friend has a copy of John Barnes’ Programming in Ada 2012 I can borrow, but I’m wondering if there’s anything else worth reading.

        Also, thank you for pointing out the issue with the Option example, I’ll make an edit to the post at some point today.

        1. 5

          It’s funny how perspectives change; to C and JavaScript people, we have a huge standard library, but to Python, Ruby, Java, and Go people, our standard library is minuscule.

          1. 2

            I remember when someone in the D community proposed to include a basic web server in the standard library. Paraphrased:

            “Hell no, are you crazy? A web server is a huge complex thing.”

            “Why not? Python has one and it is useful.”

          2. 2

            What you don’t use, you don’t pay for [BS94]

            That is true however you have little impact on what others use. Those features will leak into your code via libraries or team mates using features you might not want. Additionally when speaking about kitchen & sink I didn’t only mean the standard library, the language itself is much larger than C.

            I think my friend has a copy of John Barnes’ Programming in Ada 2012 I can borrow, but I’m wondering if there’s anything else worth reading.

            Last I did anything related to Ada was somewhere around 2012. I recall the Barnes books were well regarded but I don’t know if that changed in any significant way.

            For casual reading the Ada Gems from Adacore are fun & informing reads.

            1. 2

              I’ll definitely take a look at Ada, seems like a very promising language. Do you have any recommendations for books? I think my friend has a copy of John Barnes’ Programming in Ada 2012 I can borrow, but I’m wondering if there’s anything else worth reading.

              I recommend Building High Integrity Applications in SPARK. It covers enough Ada to get you into the meat of SPARK (the compile time proving part of Ada) and goes through a lot of safety features that will look familiar after looking at Rust. I wrote an article converting one of the examples to ATS in Capturing Program Invariants in ATS. You’ll probably find yourself thinking “How can I do that in Rust” as you read the book.

          3. 2

            Nice article thanks. I liked your very rational approach to evaluating the language. Way too much programming language comparison seems more ego driven than fact driven and it’s nice to see it done cheerfully and without team calling.

            1. 1

              Thanks for the feedback! I’ll be sure to keep that in mind when I go off to write more posts like this

            2. 2

              Is there a way to print a string in Rust that generates simpler assembly? Would avoiding the println! macro achieve that?

              1. 2

                I looked into it and it seems that there is. It’s still a little more convoluted than the C example because it has to allocate a handle for stdout, but I think that it’s an improvement over what’s there right now. I’ll make an edit, thank you for the suggestion :)

              2. 1

                Does this means Rust dumping a lot assembly code than C by providing some feature over the developer side?

                Please consider my above thought as humble question, I haven’t even write a single program in Rust but I found lots of good word about it from the community and may be in future I will give a try.

                But, I found that FF is fast now but taking huge memory ( > 750 MB while running with couple of tabs ) and process ( 54% of total process ) on my Pentium system. It just my thought that Rust provide good abstraction by giving an easiness way to write system code but dumping lots of code that make it huge and processor lover! Don’t consider me negative, I may wrong, but just asking you for further explore.

                1. 1

                  There’s still so little Rust in Firefox compared to the whole codebase that that shouldn’t be the sole issue with something like this.

                  In general, it should be roughly the same as C or C++, not significant more. Sometimes it’s less!