4 ms·
Is rust code heavily seasoned with unsafe keyword really that hard to prototype in? Is it meaningfully harder than c++ in this regard?
by hamilyon2 4y ago
Is rust code heavily seasoned with unsafe keyword really that hard to prototype in?
Is it meaningfully harder than c++ in this regard?
- spoiler 4y agoI assume they didn't mean compared to C++. If anything, saying prototyping in C++ is easier than Rust is beyond ludicrous even if you're a seasoned C++ developer. I'd have an easier time prototyping in Rust than C++, and I've been writing C++ for 10 years and Rust for a little over a year. However, prototype in something like Ruby (or even TypeScript, and some people mentioned Elixir) is in a different universe compared to C++ or Rust. Like, it's not even a "fair fight" to compare it meaningfully.
- cozzyd 4y agoWell there are C++ repls available. Maybe there are rust ones too?
- GuB-42 4y agoWhat makes Rust better at rapid prototyping? Cargo? I find that modern C++ "kitchen sink" approach to features makes it good for rapid prototyping, a bit like Perl on the dynamic side. It won't force you into a specific approach, pick the one that gets you there the fastest. Use raw pointers and malloc(), or use fancy smart pointers and RAII, your choice, you can also do both, you have exceptions, you have goto, you can write(), printf() and cout, you have classes and lambdas and (multiple) inheritance and traits. More options are better for rapid prototyping. Also, C++ is the most popular language for competitive programming, you can't get more "rapid" than that.
- craftit 4y agoFrom what I've experimented with so far the biggest barrier to using rust was having a mature ecosystem of libraries to use. This is changing though!
- oconnor663 4y agoIf I wanted to just blast out something quick and dirty, I don't think I'd reach for `unsafe`. It's syntactically inconvenient, with lots of `(*foo).bar` and `MaybeUninit`. And I don't think I could be happy with a prototype that's blatantly full of UB, so for me it would take more effort rather than less. Now that I say that, I guess someone could write an "unsound helper functions" library that helps you write code full of UB conveniently. It could be an interesting thought experiment. But I don't think the community would be very happy about it...