logoalt Hacker News

vor_ • yesterday at 8:07 AM • 1 reply • view on HN

> Every simple things take 5 layers of abstraction

I'd love an example of what you're talking about.


Replies

zbentley • today at 2:37 AM

As a Rust enjoyer, there are plenty of examples of that--if I interpret GP's complaint as being more about explicitness than abstraction, which is what most new-to-Rust folks I've talked to about similar complaints turn out to mean.

Box<Rc<Container<Type>> soup gets tedious. Writing higher order functions that take closures which manipulate data bounded by a related lifetime gets really tedious. Dealing with interleaved lifetimes can be a pain. Pin and async, if you're in that realm, gets tedious to write out. And the explicit notation of Send and Sync for types that, in a language like C++, would either encode their copy/ref-stability in the documentation of the type or leave it up to the programmer to handle, also gets tedious. As an inheritance lover (we exist!), having to rewrite the same/similar implementations or signatures across multiple traits and sprinkle my code with one-off enums to model a type hierarchy can also be a drag, doubly so if I'm using something that's not dyn-compatible.

Most of those things exist for good reasons, and I appreciate the capabilities provided by having them. But even as someone who likes the language, it remains tiresome to have to type them out.

➕ show 1 reply