I think I've worked out one reason I dislike working with Rust. Consider this phrase:

"For example, there is no way to write this function in a way that is generic over the Container trait"

This kind of phrasing is very common in the Rust world. But what does "generic over a trait" *mean*, exactly? I can look up what a trait is just fine, and 'generic' too, but 'over' is far too generic of a word to find anything helpful.

This is just one example, and it's not really about this specific question - more that Rust documentation often uses words in ways that are ambiguous to me, with no clear path to figuring out what is meant there.

· · Web · 4 · 1 · 5

... and I suppose that another reason I dislike working with , is that it's always "you can use this feature X except in cases where Y" and for every X there's a different Y, there doesn't seem to be a restricted set of basic code organization techniques that you can universally apply, you always have to learn a million edge cases to get anywhere

@joepie91 hm, I don't think I ever had to read a definition, but I immediately understand this to mean `impl<T: Container> { fn f(x: T) -> T }` or something like that. like, "generic over a trait" means "usable with any implementation of that trait". does the context in which you saw this phrase not make this meaning clear?

you could always ask in a chatroom if looking it up doesn't really yield anything.

@joepie91 yeah, every time I use rust I get that c++ "you must be a language lawyer to use this effectively" vibe

@joepie91 it literally just means a trait bound:

fn foo(x: T) {…}

Or

fn bar(x: impl Container) {…}

As to why this is the case, I would need more info about what restriction they’re talking about but it sounds like they’re actually explaining that.

Sign in to participate in the conversation
Pixietown

Small server part of the pixie.town infrastructure. Registration is closed.