3 ms·
How well does it prevent doing stupid things? Can one cause use-after-free errors? Can one read/write memory out of bounds? Can one create a race condition? Doe
by Panzerschrek 6mo ago
How well does it prevent doing stupid things? Can one cause use-after-free errors? Can one read/write memory out of bounds? Can one create a race condition? Does it all require using some sort of separate "unsafe" subset of the language, or doing so is possible in regular code?
- arisim 6mo agoYou can cause use after free if you manually allocate memory (which isn’t required at all because my ARC implementation manages memory for you and I implemented compile time heap promotion). Out of bounds reads and writes are caught by the compiler in best effort (ofc I can’t detect out of bounds errors if you offset a `*void` by an arbitrary number that was alloced with `mem::malloc` _somewhere_ but I do my best to catch common pitfalls). You can create a race condition but I tried to make the languages as much of a batteries included language as possible, so the stdlib provides primitives to avoid data races. There is no unsafe subset, if you want to do stupid stuff, the language allows you to do so (within reason) :D