4 ms·
I don't follow your first point—the compiler is pointing out exactly what the problem is (the argument has the incorrect type) and then telling you what you lik
by necubi 2y ago
I don't follow your first point—the compiler is pointing out exactly what the problem is (the argument has the incorrect type) and then telling you what you likely wanted to do (borrow the String). What would you see as a more helpful error message in this case?
- crabbone 2y agoThe compiler says "expected X, but found Y". I don't know how to interpret this: is the type of the thing underlined with "^^^" X or Y? "Expected" and "found" are just like "up" and "down" in space: they are meaningless if you don't know what the compiler expects (and why should it?). What it needs to say is something along the lines of "a function f is defined with type X, but is given an argument of type Y": maybe the function should be defined differently, maybe the argument needs to change -- it's up to the programmer to decide.
- jacksnipe 2y agoSince it's underlining code you wrote, it must be "found" that is highlighted, not "expected". Much like up and down, gravity exists to ground all of us in the same direction.
- shakna 2y agoI'm over here with TTS: Underlining in a terminal rarely translates to audio. It isn't the only consideration that needs to be made, when making things clear.
- knowitnone 2y agoexcept nobody has to cater to every worst case scenario
- shakna 2y agoSo every disabled programmer is now a "worst case scenario"?
- SunlitCat 2y agoOr in short, Rust isn't for disabled programmers?
- BlarfMcFlarf 2y agoI am sure the Rust community would welcome feedback from blind developers about their error messages. Accessibility is a good thing.
- steveklabnik 2y agoOne thing that could help here is that the compiler is able to offer output in JSON, allowing you to format the messages however you'd like: https://doc.rust-lang.org/rustc/json.html https://doc.rust-lang.org/rustc/json.html I'm not aware of an existing tool to produce blind-friendly output, but this would at least be a part of that!
- jacksnipe 2y agoI hadn’t considered this use case, thank you for pointing it out!
- nuancebydefault 2y agoI don't see any way that the use if expected and found can be ambiguous for a type conflict. I buy a fruit mixer from Amazon.com ; I send it back along with a note: expected a 230VAC mixer, found a 110VAC mixer.
- kelnos 2y agoI dunno, I feel like if you've used a compiler regularly, "expected X, but found Y" is a pretty common idiom/shorthand that people understand. Your wordier version of that feels unnecessary to me.
- tartoran 2y agoC is a low level language and deals with things close to the metal. It's probably not fun to write a large business app in barebones C but you having control over low level things makes other things possible and very fast too. Depending on the type of problem you have use the appropriate and favorite language.
- crowdstriker 2y agoYou cannot be serious right now.