3 ms·
> That's not really high praises, "I expected Foo and you gave a Bar" is pretty much level 0 of static type checking which even javac manages, you'd have to wor
by arielb1 11y ago
> That's not really high praises, "I expected Foo and you gave a Bar" is pretty much level 0 of static type checking which even javac manages, you'd have to work hard to fail to provide even that.
If you know the language well, there really isn't anything more to say - your code wants the `Debug` bound, but it is not present. Either change your code or add the bound.
I am going to improve the error reporting to use a better error message in this case.
- masklinn 11y ago> If you know the language well Right, that's the problematic assumption. The compiler message aren't going to be problematic if the compiler already trained you.
- steveklabnik 11y agoWhile I don't disagree with your point, I don't agree with your reason. It's not that the compiler has trained you, it's understanding that you must bound generics by a trait to be able to call methods on the resulting value. That's a language-level understanding rather than a reading of tea leaves. This is also one reason why --explain was added; hopefully the extended diagnostics can help with unfamiliar errors. More experienced users need --explain less.
- masklinn 11y ago> it's understanding that you must bound generics by a trait to be able to call methods on the resulting value. That's a language-level understanding rather than a reading of tea leaves. Sure but here's the thing: the compiler could know report that, as you note that's language-level understanding, who's to better know the language than the compiler? > It's not that the compiler has trained you Maybe saying that you[0] trained yourself (in this case to pattern-match that a type mismatch between a generic T and a trait is pretty certainly a missing bound on T) would be a better way to put it? The point is, the compiler could[1] be much more precise in its diagnosis, and much more assisting and "mentoring" in its output, but a few people argue that it's unnecessary, because they've built not just a mental model of rust but a library of pattern-matching "low-level" compiler errors into higher-level language errors and can do it in their sleep at this point. [0] generic, you, me, pcwalton, dons, oleg, basically anyone working with a compiler [1] I am very much not saying it's easy
- steveklabnik 11y agoI do certainly agree that we can do a lot more. There's always so many things to do...
- masklinn 11y agoTime to get this cloning thing up and running, might be easier to get more of you than to get you alone to fix it all.