4 ms·
Bothsidesism is unhelpful in technical discussions just as much as in politics. If you have specific critiques please share them. I have a number of specific c
by howinteresting 6y ago
Bothsidesism is unhelpful in technical discussions just as much as in politics. If you have specific critiques please share them.
I have a number of specific critiques of Rust, chief being that APIs and implementations are bound too tightly. &[String] and &[&str] are logically similar but changing from one to the other in your implementation might mean a breaking API change.
- hctaw 6y agofn func (slice: &[impl AsRef<str>]) { // ... }
- howinteresting 6y ago* You have to remember to do that. * I was thinking return values. * Also you can't use that style in an enum definition if you want to return a custom enum.
- hctaw 6y agoIf you need api flexibility you use generics, and that is the way to be generic over types that refer to strs. I'm pretty sure this is in the book, and it's common enough that even someone who doesn't use rust full time (myself) knows it off the top of their head You can use impl Trait in returns, this is actually one of the reasons why that feature exists. And yes, you can use generics in an enum.
- howinteresting 6y agoYou have to expose the generic in the enum though. Rust doesn't have existential types at the moment.
- pornel 6y agoI think it's a valid criticism. Ownership, mutability, and thread-safety are not easy to abstract over and hide as implementation details in Rust. It's a side effect of the fact that Rust actually cares about these and checks them strictly, but for users coming from eg Java that's a bit of a shock.
- deleted 6y ago[deleted]