3 ms·
Rust, IMO is a noisy language. So not surprising it took more lines. Having to handle every case of every branch also probably balloons line count. Efficient
by dartos 2y ago
Rust, IMO is a noisy language. So not surprising it took more lines.
Having to handle every case of every branch also probably balloons line count.
Efficient LOC is not a goal of rust at all anyway.
- Cthulhu_ 2y agoEfficient LOC shouldn't be a goal or metric anyway, readability trumps conciseness... except when conciseness improves readability.
- rootnod3 2y agoAgreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.
- pmarreck 2y agoExactly. I wish all languages implemented things like this, a bit more strictness (such as requiring all possible match cases to be handled across a set of inputs) goes a long way
- rootnod3 2y agoNot all though. I am currently writing my own Lisp dialect, and as much as I wish and hope I will be able to force case/switch to be exhaustive, I don't see a direct way for that in a dynamically typed version. I do plan to add something similar to Clojure's spec though, so the compiler can at least be advised about things and warning if stuff is missing. But I do agree, any statically typed language should have that check and not just warn about it. It should be a hard error, no questions asked. And I love that Rust didn't relegate it to a warning that could be turned be into an error.
- sceptic123 2y agoIf conciseness improves readability then doesn't readability still win?
- darthrupert 2y agoSo is C++ though. But the "wasteful" (in terms of vertical space) formatting does indeed explain the difference.