Hello Friend, On 06/21/24 10:45AM, Greg Reagle wrote: > I am not a fan of C because of problems like buffer overflows; weakly typed > arrays; lack of (built-in) range checking for enumerations, numeric types, > arrays; lack of overflow checking; string handling being too complex. > Basically what you might call "safety and ease issues." I am not comparing C > to garbage-collected languages because they are different domains. I am > comparing to other compiled and high-performance languages that lack garbage > collection.
What if C & Rust were in different domains? For example - C is a language designed to describe how to operate on a fixed address space - Rust is a macro preprocessor & type system that allows you to generate code by providing a minimal set of trait & lifetime constraints In this case, saying "C lets you overflow a buffer" is like saying "Rust lets you write types that do way too much behind the scenes". Given that the implementing the right data structures are a significant part of what makes an application performant, I don't think there's a replacement for C. You might say "alternatives to grep: awk, ripgrep... ripgrep can browse the whole filesystem using multiple threads. awk can add" but wants to write '/' everytime they write a regex? sometimes I just want to run a single regex over a stream of input. I wish Rust would have stuck with persuing being a safe language. You can still overflow the stack. You can still go OOM. There's nothing novel. Lifetimes in rust was a cool idea to see implemented, but I really wish they'd gotten weird with it. Imagine Lifetimes for stuff on the stack. Then "yeild" is no-cost. Modern-day Coroutines(rhymes with Goroutines, which upsets some people). Everything's recursive now because who gives a shit - you don't have a stack to blow out because you've got "stack-safety" too. Oops, forgot something: files have a lifetime beyond the scope of main. Program doesn't compile if the file doesn't exist on the FS. We only support NixOS now. DNS resolution is now free since it happens at compile time. don't run the program after DNS expiration. it's undefined behavior. Jeremy