3 ms·
I'm looking at it through the lens of "let Rust have the best possible newcomer experience", which of course isn't a sentiment that has to be shared by the crea
by pdimitar 6y ago
I'm looking at it through the lens of "let Rust have the best possible newcomer experience", which of course isn't a sentiment that has to be shared by the creators.
I suppose I appreciate SmallString's ability to alias itself to Rust's String.
But I'd immediately agree that this adds hidden complexity and the potential for it to bite you in the worst possible moment.
- steveklabnik 6y agoEven with that perspective, you can disagree. Offering even more string types may be more confusing for users.
- pdimitar 6y agoYep. I was kind of thinking out loud but was curious about your perspective. Thank you.
- steveklabnik 6y agoTotally! That's how progress is made, thinking out loud :) Thank you too!
- pornel 6y agoI like that Rust's String is not trying to be smart. It makes it predictable and easy to reason about. Because Rust has &str as the lowest common denominator for all string types, "non-standard" strings aren't difficult to use.
- pdimitar 6y agoI agree that less smartness is a good thing, it's just that sometimes I get a bit frustrated even with basic usages of Rust's String and &str. It gets easier with time but the first few months were a big struggle.
- brundolf 6y agoGoing along with the other replies, I disagree that this would improve the experience for newcomers. SmallString is a hyper-optimization for specialized use-cases which (I would assume) is rarely worthwhile. I would actively discourage people from using SmallString without first profiling to identify Strings as their bottleneck, especially newcomers. String will almost always be "fast enough".
- pdimitar 6y agoAgreed that it's a very likely unneeded optimization. As shared in another sibling comment, I got frustrated with Rust's strings and figured that maybe one more complexity on top wouldn't be that bad. But thinking of it now, yeah, it's definitely a bad idea.