self isn't always the first argument, though It's not for foo<T: Trait<U>, U>(x: bool, y: T, z: U), and you'll have similar problems here the UFCS call is basically eq<T: PartialEq<U>, U>(&T, &U)
-
-
Replying to @ManishEarth
Right, which is why I wouldn't want to treat `self` as special at all, rules for dispatching both are the same. Fewest derefs left to right. (don't deref T, try derefing U repeatedly, if you find an impl stop, deref T once, ...)
1 reply 0 retweets 1 like -
Replying to @sgrif
"left to right" assumes that there's a function here *at all*, though
2 replies 0 retweets 0 likes -
Replying to @ManishEarth @sgrif
i guess you can special case for deref coercions that are happening in function call arguments only
1 reply 0 retweets 0 likes -
-
Replying to @sgrif
?? we don't? we treat deref coercions the same everywhere. autoderef is special, but it works totally differently
1 reply 0 retweets 0 likes -
Replying to @ManishEarth
Function arguments where the only place that you cannot consistently rely on `&` performing deref coercion
1 reply 0 retweets 0 likes -
Replying to @sgrif2 replies 0 retweets 0 likes
-
Replying to @ManishEarth @sgrif
that said, function arguments are the place where this is the most obvious culprit. everything else where this happens is usually when your code is very inference-heavy and generics-heavy enough that there's no single culprit totally could special case functions for this
1 reply 0 retweets 0 likes -
Replying to @ManishEarth @sgrif
of course, my example is kinda contrived, but trait constraints can bubble out of inference in weird action-at-a-distance ways at times as well.
1 reply 0 retweets 0 likes
Sure. I feel like the biggest supporting argument for all of this is that if in any ambiguous case for these the impls it could pick behave remotely differently, your code is already crazy ambiguous
-
-
Replying to @sgrif
yeah definitely, mostly trying to underscore the point that this problem is larger than just functions, and while we might get the most utility out of adding a special case step for functions, it's important to look at it as a more general thing
1 reply 0 retweets 2 likes -
Replying to @ManishEarth
Yes. I appreciate the concrete example demonstrating where this applies outside of function calls. I mistakenly thought that was the only place. It's really any place there can be multiple type generic types interacting
0 replies 0 retweets 3 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.