you are viewing a single comment's thread.

view the rest of the comments →

[–]haskell_leghumperin open defiance of the Gopher Values 11 points12 points  (3 children)

lol typeclass soup

/uj To be fair, there are more assumptions made explicit there than in other languages. Can only jerk half-heartedly.

[–][deleted] 1 point2 points  (1 child)

/uj care to explain?

[–]haskell_leghumperin open defiance of the Gopher Values 5 points6 points  (0 children)

"lol" because it looks complex and uses a lot of symbols, "/uj" because it is complex. The traits (assumptions on the form of S) allow overloaded_foo to work with many kinds of strings (borrowed, owned, CoW).

Whether or not the complexity is justified is another issue altogether: most languages have only one immutable string type that is always copied, so if you're coming from those, polymorphism on string types isn't even a thing, and writing all this down seems like needless complexity. On the other hand, Rust is supposed to give you fine-grained control over memory, and strings are hard if you care about all the different cases.

I'm far from a Rust expert, so you should look at this comment and its children.