The way I approach situations like that is to write code in Lua and only push stuff that really has to be fast down to C. (Even C+liblua / using a Lua state just as a calling convention is IMHO often nicer than “plain” C. I can’t claim the same for Python...) End result is that most of the code is readable, and usually (i.e. unless I stopped keeping them in sync) the “fast” functions still have a Lua version that permits differential testing.
Fundamentally agree with the C not C++/Rust/… theme though, C is great for this because it doesn’t have tons of checks. (And that’s coming from someone who’s using Coq / dependent types regularly, including at work.) Compilers generally want to see that the code is safe under all possible uses, whereas you only care about the specific constellations that you actually use when prototyping. Convincing the compiler, disabling checks, and/or adding extra boilerplate adds overhead that seriously slows down the process of exploration, which is not something that you want to deal with in that mode.
The way I approach situations like that is to write code in Lua and only push stuff that really has to be fast down to C. (Even C+liblua / using a Lua state just as a calling convention is IMHO often nicer than “plain” C. I can’t claim the same for Python...) End result is that most of the code is readable, and usually (i.e. unless I stopped keeping them in sync) the “fast” functions still have a Lua version that permits differential testing.
Fundamentally agree with the C not C++/Rust/… theme though, C is great for this because it doesn’t have tons of checks. (And that’s coming from someone who’s using Coq / dependent types regularly, including at work.) Compilers generally want to see that the code is safe under all possible uses, whereas you only care about the specific constellations that you actually use when prototyping. Convincing the compiler, disabling checks, and/or adding extra boilerplate adds overhead that seriously slows down the process of exploration, which is not something that you want to deal with in that mode.