4 ms·
Is it safe? Or it is just yet another C replacement with footguns placed everywhere?
by Panzerschrek 6mo ago
Is it safe? Or it is just yet another C replacement with footguns placed everywhere?
- arisim 6mo agoIt’s as safe as I could make it. It uses ARC under the hood and I have a bunch of warning systems and whatnot to prevent people from doing stupid things. It’s still a fairly low level language so if you really want to do dumb things you still can tho. But I also run my entire Tin test suite through valgrind on a regular basis and not seeing any issues memory management wise :)
- Panzerschrek 6mo agoHow 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