1. 6

    I think it’s too soon to be picking a language to replace C. Sure it could do with replacing, but the field is advancing incredibly quickly at the moment: With time, my money would be on Zig as the generally preferred successor, over Rust.

    1. 6

      I’d prefer something now instead of waiting another five years. I’m perfectly happy with something good. instead of something perfect. There are infrastructure adoption effects to think about.

      (I would have preferred a C replacement in the early 00s, but the technology just wasn’t there yet.)

      1. 5

        The problem is that the would-be alternatives are constantly changing making adoption potentially more costly, where as C is largely unchanged since C99.

        1. 4

          The technology was there back then, but nobody bothered to make a production quality tool out of it. Which just reinforces your point about choosing something now to take this out of academia.

          I’m not that hot about rust myself (c++ level complexity in places, and the sigil soup doesn’t help), but the cambrian explosion in tools recently only means that people will get used to using different tools in the same project.

          1. 4

            Ada was in production at the time.

            1. 1

              But not with a great open source story, unfortunately.

              1. 1

                That’s true. Many were paying for IDE’s and compilers, though. So, it was there at least for them.

            2. 1

              I’m sorry if this is an ignorant question, but what is sigil soup?

              1. 2

                It’s not an ignorant question :-)

                Sigils: “magic” symbols.

                Sigil soup: lots of sigils, for example (randomly picked from somewhere on the web):

                struct Sub<'a> {
                    name: &'a str
                }
                

                There’s lots of stuff going on in that short snippet that is signified by such “magic symbols” (&? ‘? &’?). Contrast that to Ada whose most curious syntactical feature is probably the Type’Attribute syntax while everything else is spelled out in rather verbose and easy to follow language. (although the Ada 2012 expression functions aren’t really helping readability either, in my opinion)

                1. 1

                  What’s “magic” here? Verbose? Yes. Magic? No. It would be entirely possible to allow this as

                  struct Sub {
                      name: &str
                  }
                  

                  (and indeed, in some function signatures, the 'a can be elided)

                  But that would lead to the introduction of an implicit generic parameter (anonymous lifetime), making diagnostics quite a bit harder. The current situation is clear: Sub has a lifetime that is bound to the lifetime of the reference in “name”.

                  Indeed, the change was discussed, but we decided to keep it clear when a structure is one where the borrowing rules apply. In the current version, all you need to look at is the structure generic parameters, otherwise, you’d have to look at every parameter.

                  Considering that structs with private fields are notated as:

                  struct Sub<'a> {
                    // fields hidden
                  }
                  

                  In the docs, this also allows for better visibility there.

          2. 8

            With time, my money would be on Zig as the generally preferred successor, over Rust.

            But Zig does nothing about memory safety, so I don’t see it as a step up the same way I do Rust.

            1. 4

              D has already claimed the throne.

              1. 6

                I’m waiting for Pony to get a Better Horse mode.

                1. 3

                  Is that a giraffe, or an OCaml?

                  1. 2

                    A Giraffe, OCaml is better Perl.

                2. 1

                  Does anyone want to use it, though?

                  1. 11

                    To butcher the Bjarne quote, there are only two kinds of languages: the ones nobody wants to use, and the ones nobody wants to use.

                    1. 1

                      Nice!

                3. 1

                  Interesting re your statement. How come? Why Zig? Why not ATSlang?

                  1. 3

                    Zig was just the first language that came to mind as a C successor. Simplicity is somewhat key. ATS would be a completely different direction and equally as valid.

                1. 7

                  I feel like adding the logging and tests makes this borderline unreadable and crowded looking. I might just be dumb though.

                  1. 90

                    In light of all of these problems, I’ll take my segfaults and buffer overflows

                    but I won’t take your buffer overflows. I have spent enough time with emergency security patching RCEs left by C programmers who were “good enough” not to need a memory-safe language.

                    1. 9

                      “I have the best taxi service in town because my car is so fast! Yeah, it has no seat belts, but don’t worry — I’m a very safe driver.”

                      1. 1

                        This is a beautiful way to put that.

                      2. 7

                        I was thinking about this actually. I was pretty sure that those were security issues rather than just annoying. Maybe he doesn’t mean for the finished product? I hope that’s what he means.

                        1. 3

                          I’m sure he meant that, but it is still very unlikely that he or anyone else will iron out all segfaults and buffer overflows.

                        2. -9

                          So since PHP is memory-safe, it’s a good C replacement?

                          1. 23

                            Yes, if you have to choose between C and PHP, and both can do the job, you definitely should choose PHP, no question. The problem is that PHP often can’t do the job.

                            1. 17

                              That’s a very uncharitable interpretation. Brainfuck is also memory safe and is obviously not a good C replacement - obviously the only requirement isn’t memory safety.

                              1. 3

                                Yes. I chose PHP because it’s an extreme case.

                                The point is: yes, Rust is safe, but the article explains why (besides memory safety) Rust isn’t a good C replacement. In other words: there are other programming languages that are better suited than Rust to replace C.

                                1. 5

                                  I think everyone get’s your point, but it’s banal noise that pollutes the discussion, hence the downvotes, which are actually pretty rare here.

                          1. 2

                            After reading the article and all the comments I think I’ve realized why Drew maybe wrote this: other than hating Rust, that is. I have a feeling a ton of people have been asking him if he is going to start rewriting things in Rust and he’s getting really tired of it.

                            1. 25

                              I mostly agree with specifics, which boil down to “Rust is immature”. I disagree overall, because I believe Rust will be mature in the future. Rust will be portable, will have a spec, will have competing implementations, will have stable ABI (which will be better than C ABI), etc.

                              I specifically object to “attempts to integrate Cargo with other build systems have been met with hostility from the Rust & Cargo teams”. I (and I believe other Rust & Cargo contributors) am painfully aware of the problem and we are trying hard to integrate with external build systems. Cargo’s so called “build plan” mode is already implemented, and I believe this problem will be solved by 2020.

                              1. 3

                                The point Drew is trying to make I think is still fair. You are using the future tense when you say Rust will have those things; the point is that it doesn’t have them now. Who knows maybe when they do Drew will change his mind.

                              1. 2

                                I’ve been thinking about at least every other month. I’ve been eagerly awaiting this since I saw the original announcement a few years ago. I really hope they respond to you.

                                1. 1

                                  Is the store of this post using a picture of Terry Davis as his profile pick, or does he just look a lot like him?