5 ms·
At extreme cases, where you want to prove your network stack, you'd have to write it in C (or something equivalently dangerous), because you can't prove big run
by marcosdumay 10y ago
At extreme cases, where you want to prove your network stack, you'd have to write it in C (or something equivalently dangerous), because you can't prove big runtimes.
But in mid-way applications, dangerous languages are dangerous, and should be avoided.
I'd think the most "correct" way to handle this is to create small bits of network code with proof of correctness that handles down parsed and tagged (typed) data into code in high level languages. In that case, Curl type of code would still be in C.
- bluejekyll 10y agoWith Rust this tradeoff of safe-with-runtime vs. unsafe-without-runtime is no longer your only choice. Now you can choose safe-with-strong-compiler-no-runtime...
- pjmlp 10y agoThis tradeoff wasn't already an issue with languages like Modula and Ada.
- bluejekyll 10y agoYeah, I realized after posting that this would be a critique. I should have stipulated that it's a C syntactic language, which seems to be many peoples preference based on the most successful languages out there. I never did much with Ada or Modula, so I won't claim to know anything more than their syntax, etc.
- staticassertion 10y agoAs far as I am aware Ada is not memory safe without a runtime and with the presence of non-static memory. So you either have a runtime, no deallocation, or unsafety.
- pjmlp 10y agoC also needs a runtime, it is called crt0 on UNIX and it is what calls main(), sets up global initialization functions (constructor functions in GCC C), emulates floating point,... As for Ada, you can selectively disable which parts of the runtime actually land on the generated executable via compiler pragmas. Deallocation can be done via pools or controlled types.
- staticassertion 10y agoOK, I should have said garbage collector, not runtime.
- bquinlan 10y agoAre you claiming that Module-2 is memory safe? What about: MODULE Boom VAR Foo : POINTER TO INTEGER; BEGIN Foo^ = 123; END Boom.
- pjmlp 10y agoIf I remember correctly that is a compiler error, because Foo is not initialized, so no boom. But if you still want to get your point through and have a boom. MODULE Boom; IMPORT SYSTEM; VAR Foo : POINTER TO INTEGER; BEGIN Foo := SYSTEM.CAST(POINTER TO INTEGER, 43414); Foo^ := 123; END Boom. Notice the use of IMPORT SYSTEM and SYSTEM.CAST, explicit, easy to search for, and to forbid via compiler switch (no unsafe code).
- AstralStorm 10y agoRust still has no support for true formal analysis. It is therefore pointless to use it for high safety. Use a real theorem checker instead. Now Rust as a target for compiling proofs into a programming language is pretty nice. Safe code can have no aliasing due to borrow checker (which should also be formally verified). Threading issues are vastly simplified, though fairness still has to be verified, as well as a few other properties.
- bluejekyll 10y agoCould this be used on the LLVM intermediate code? http://www.cis.upenn.edu/~stevez/vellvm/ http://www.cis.upenn.edu/~stevez/vellvm/
- AstralStorm 10y agoGood find. Likely yes.
- pohl 10y ago...you'd have to write it in C (or something equivalently dangerous), because you can't prove big runtimes... In order for this argument to hold, we would have to live in a world where no one has created a safe language with no runtime. We don't live in such a world, fortunately.
- marcosdumay 10y agoWait, is there a high level language (not assembly) with no runtime out there? I don't think we are talking about the same thing at all.
- steveklabnik 10y agoThey're making an oblique reference to Rust; it has the same level of runtime that C does. Many people say "no runtime" to mean "small runtime like C or C++ have" rather than literally no runtime. This is due to the confusion around interpreters sometimes being called "runtimes."
- marcosdumay 10y agoI suspect it was something about compiled vs. interpreted. The Rust runtime is larger than C's (I imagine it's not much larger than C++, but this is already way too large). AFAIK, nobody ever proved it works as designed. The fact that it's design is not very stable is also a problem. Now, with some more thought about it, C itself is not a great target for correctness proofs. Too much is left unspecified, and there is little agreement over some of the lower level stuff. A simplified version of Rust might be a better target than C, if somebody ever creates it, but a lot of the safety would have to be left out of it.
- Manishearth 10y agoIIRC Rust by default brings in a few things (panic handling is the main one, and also jemalloc) that make its runtime larger than C (but not larger than C++), but they can be disabled with compile flags. Many folks do, for embedded stuff. Rust also lets you write a custom runtime by specifying a start function if you want. > The fact that it's design is not very stable is also a problem. Rust is stable.
- 0xFFC 10y agolook at this : https://math.mit.edu/research/highschool/primes/materials/2015/Sheth-Welling.pdf https://math.mit.edu/research/highschool/primes/materials/20...