3 ms·
Yes, both C and Unix are amazing designs. Far from perfect, but good tools for many jobs. In my opinion, it is now time for Rust to take over. But comparing Rus
by phicoh 2y ago
Yes, both C and Unix are amazing designs. Far from perfect, but good tools for many jobs. In my opinion, it is now time for Rust to take over. But comparing Rust to C, it took a huge amount of improvement over C to replace C.
- kragen 2y agoi don't think rust has replaced c, or is likely to preceding c, there was a large, complex, portable algol-family language capable of handling a range of applications similar to c's, called pl/1. if you read 'the elements of programming style', from about the time c was born, many of the examples are in fortran; most others are in pl/1. gary kildall's first job working on microcomputers was at intel writing pl/m, a cut-down pl/1 for microcomputers, for which he wrote cp/m, from which ms-dos grew. ibm's database db2 is still written in a dialect of pl/1 called pl/x. one of wirth's first languages was a thing called pl/360, which was a version of pl/1 with extra low-level facilities for bootstrapping a better language in short, pl/1 was very widely used and highly influential, even though it's almost forgotten today and that's because it kind of sucked. compiling it required a large computer and even then was slow. even at the beginning, it was highly complex, so learning it took a long time. this got worse over time as more and more features were piled onto it, often as ill-advised efficiency hacks that then couldn't be removed, because people's programs depended on them. because it was highly complex, and there were a lot of surprising problems that resulted from complex interactions of all its complex features; compiler developers improved this situation significantly by working hard to provide better error messages, but that only diminished the problem rather than eliminating it the preceding paragraph describes rust exactly as well as it describes pl/1, so if someone succeeds in producing a c-like small, simple language that provides enough of rust's unique advantages (which are indeed very compelling) i expect that it will replace rust i doubt it will replace c tho
- phicoh 2y agoIn my opinion, Rust, though large, is in some sense quite minimal. Lot's of features in Rust are actually needed to allow the compiler to statically reason about memory safety. And this is why Rust is likely going to take over from C, not because it is the most C-like design, but because it can provide static safety guarantees. There is considerable pressure, at least for internet facing code, to show that it is safe. And that is way to hard to do (and keep doing) for C. Of course, somebody may come up with a brilliant design. But lots of organizations don't want to wait for that. They don't want to keep writing new code in C. And Rust has by now a mature compiler, a very active community.
- kragen 2y agoyes, i know the goals and achievements of rust don't conclude there isn't a better solution just because you haven't seen one yet
- phicoh 2y agoI'm not saying anything about what is possible. What would be the amount of time it takes to create a new language, create a stable compiler, create a sizable community? It can easily be ten years. There are lot's of organizations that are not going to wait ten years. And we still have to wait for the language to be designed in the first place to suggest that waiting might be an option. And 10 years from now, the people who have running Rust code are no going to switch to a language that is similar to Rust but may have a slightly better syntax or otherwise be closer to C.
- kragen 2y agoyou said, 'Rust, though large, is in some sense quite minimal. Lot's of features in Rust are actually needed to allow x' this logically entails that x is not possible without those features. if x is possible without them, they are not actually needed to allow x. so, although you hadn't noticed, you were saying a lot about what is and isn't possible there are lots of organizations still using cobol, and people who have running cobol are not in any hurry to switch, either. but i have the luxury of not having to care
- phicoh 2y agoObviously Rust has some features, like async, that are not needed for 'C with safety'. But in my experience you need most of the other features. So any 'C with safety' will have a lot of the complexity of Rust. Though of course the syntax and defaults may be different. At some point it becomes very subjective. Does a language need a UTF-8 string type, or is an array of 8-bit characters enough? The research question would be, what is a minimal subset of Rust that still allows for programs that are commonly written in C to be easily written in this subset. Some things, like the tuple type, or 'if let' can be removed, but is it still convenient to write programs without them? Closures are a bit tricky to see if they can be removed. In any case, C struck a very good balance between being small and powerful. In my opinion Rust strikes a similar balance. Rust is a lot bigger, but it gives powerful tools to write reliable code.