| ▲ | mbo 11 hours ago | |
I never understood why Rust couldn't figure this shit out. Scala did. > If a crate doesn’t implement serde’s traits for its types then those types can’t be used with serde as downstream crates cannot implement serde’s traits for another crate’s types. You are allowed to do this in Scala. > Worse yet, if someone publishes an alternative to serde (say, nextserde) then all crates which have added support for serde also need to add support for nextserde. Adding support for every new serialization library in existence is unrealistic and a lot of work for crate authors. You can easily autoderive a new typeclass instance. With Scala 3, that would be:
> Here we have two overlapping trait impls which specify different values for the associated type Assoc.
Scala catches this too. | ||
| ▲ | switchbak 11 hours ago | parent [-] | |
Perhaps I'm insufficiently caffeinated, but isn't the author describing the expression problem? That basically nails what type classes are for (in Scala and elsewhere), no? | ||