2 ms·
> There are plenty of programs written in C that will not kill No, of course not (see analogy) - It will just make me wish for sweet, sweet release of death (
by Ygg2 4y ago
> There are plenty of programs written in C that will not kill
No, of course not (see analogy) - It will just make me wish for sweet, sweet release of death (see hyperbole).
Point is, you can eliminate a class of nasty bugs. And instead you double down on it.
So, I'll use a more programming example. C has more foot guns than just memory issues e.g. `if (a=4)`.
For all its faults, Java only allowing boolean expression in if statements was a move in right direction.
Now imagine after Java some C inheritor (Rust, Go, Carbon, Zig, Nim...) looked at `if (a=4)` and said. Yes. We need that in our lang.
Can't you see we regressed in this hypothetical example? We traded correctness for expressivity.
Same with memory safety. Rather than using a GC or some borrow checking system, we shrug and say, well what can ya do?
- UncleEntity 4y ago> Rather than using a GC or some borrow checking system, we shrug and say, well what can ya do? Try different paths until someone stumbles on the One True Way™. Plus, `if (a=4)` will emit a compiler warning of ‘statement always evaluates to true’ or somesuch and is useful in some cases like ‘if (!(a=foo())) goto error;’
- Ygg2 4y ago> Try different paths until someone stumbles on the One True Way™. I'm aware there isn't a perfect solution (because of Rice Theorem). But we don't need perfect, we need better than status quo (C). > Plus, `if (a=4)` will emit a compiler warning It's still a step down. What is better than a compiler warning that people can ignore? Prohibiting the syntax altogether. > goto error; This is another example of a famous chain-footgun. Most langs eschew use of goto even if it allows more flows than plain old for/while loops.