Conversation

btw if anyone is genuinely interested in "solving" defaults-affect-inference in Rust, this is the final boss. to the best of my knowledge, if you can make *this* work (and avoid horrible problems with different defaults colliding), then you have completely solved the problem.
Quote Tweet
Replying to @Gankra_ and @UINT_MIN
but here's the problem, this code compiles today: String::from_utf8([1, 2, 3].into_iter().collect()) from_utf8 takes a Vec<u8>, so this is actually unambiguous. But now what happens if String becomes String<A=Global> and wants to make from_utf8 work for all A? Oops! Ambiguous!
4
35
Implicits to the rescue? (I don't know anything about implicits but I do know that Scala 3 is pretty rigorously formalized so maybe they are less terrifying now than they initially appeared?).
2
I don't think anything more complex than the givens would be needed (from what I can understand). Although, reading a bit, I don't think Scala can implicitly resolve context types this way, only values? Or do I have that wrong? I'm not sure if that changes things fundamentally.
1
Hmm ok. I think I was imagining the custom allocator could be a context param. Still unsure what you think Scala 3 would specifically bring to the table here?
1
I mostly have just heard that implicits had a lot of theoretical issues in Scala 2 that were resolved in Scala 3, so I figured if Rust were going to learn from an implementation of implicits that would be a better place to start.
2
I confess I haven’t followed Scala 3 recently, but I’d have thought the biggest improvements in foundations were more on the DOT side than on inference and implicits?
2