Hello, folks! I'm trying to put together a list of shortcuts and other tricks, in order to discover and document a subset of Rust that is more suitable for rapidly prototyping ideas. I'll explain:
Rust's focus on correctness and memory layout has a number of laudable benefits, for example: "If it compiles, it (generally) works!" It also forces its users to consider things that they might not, otherwise, and the quality and design of the code becomes all the better for it.
However, these same qualities make Rust less pleasant for sketching out and exploring an idea when compared to a language like Ruby, where one can extremely rapidly get something quick and ugly working, and then refactor to a better design, once the problem is better understood.
So, in practice, I find myself prototyping ideas for Rust programs in Ruby or Node.js if the idea involves async stuff, and then once I discover what I'm actually building, and am happy with the overall design, I port the prototype to Rust.
This works well enough, but it'd be great if I could just do the whole thing in Rust! With that in mind, I'm trying to compile a list of ideas to make Rust a bit easier to hack around with when correctness and performance are explicit non-goals. This is what I have so far, and it ain't much! Help?
- Problem: The borrow checker is really getting in my way! Solution: If the data is mutable, just Arc it. If its immutable, .clone() it. Play zero-copy golf later!
- Problem: The compiler is complaining about size not being known at compile-item. Solution: Box it! Fuck it, Box everything! Throw it all on the heap!
- Problem: The compiler is asking me to explicitly consider every possible-but-unlikely failure state. Solution: .unwrap() all the things! Happy path is good enough for now!
What else could we add to this list?
In conclusion, I'd like to prototype in a deliberate flavor of Rust that is amenable to rapid development and experimentation, and then refactor to "good" Rust, later. What might this flavor look like?