3 ms·
> If you have to annotate everything to death, Isn't this how rust works? People seem okay with annotating everything.
by lelanthran 4y ago
> If you have to annotate everything to death,
Isn't this how rust works?
People seem okay with annotating everything.
- pjmlp 4y agoNo, because of language semantics much of that is already in no need for the annotations, other than one needs to go away from the well behaved path.
- pron 4y agoTrue, but C programs that follow the same structure would require about the same amount of annotation. A language can force you to write programs in a way that makes some properties easy to prove, but if you write them in that way, they can be easy to prove in any language. The difference is that instead of rejecting a different kind of program, the analysis will fail to prove, at which point you can either add more annotation or restructure the code to make it easier to prove.
- pjmlp 4y agoThey need much more due to C´s semantics, that is why there are companies like the one on this thread selling verification services and tooling. It is also the reason why Microsoft has acknowledged their idea of lifetimes checker did not went as well as planned, and they had to rethink it, https://devblogs.microsoft.com/cppblog/high-confidence-lifetime-checks-in-visual-studio-version-17-5-preview-2/ https://devblogs.microsoft.com/cppblog/high-confidence-lifet...
- pron 4y agoFor arbitrary code, which is precisely my point. Code written in C in the same style as Rust is no harder to analyse than Rust code. What a new language can do is reject code that's not easy to analyse. It's code that's not written in that way in C that's hard and requires either more annotations or a restructuring (which may still be easier than a rewrite in another language).
- ttfkam 4y agoIt's a good thing all developers in all groups on all projects at a company always conform to the same style in the real world. Otherwise the plan for annotating C might run into some stumbling blocks.
- pron 4y agoAnd it's also good that migrating a codebase to a new language with questionable prospects carries no risk or cost. Otherwise its adoption rate could disappoint.
- danuker 4y agoI am not okay with it, which is why I never bothered to learn Rust. In my (caveat-filled) analysis of verbosity, Rust is on the wordier side of languages (about as verbose as Java). https://danuker.go.ro/programming-languages.html#non-math-map https://danuker.go.ro/programming-languages.html#non-math-ma...
- ttfkam 4y agoDid you learn C? According to the chart you linked, C, C++, and Go are all more verbose than either Java or Rust.
- danuker 4y agoI did, being forced to in high school. I was never fond of it. Go is only a bit more verbose. Programs have a wide variability which is not graphed.
- ttfkam 4y agoSo perhaps it isn't the verbosity per se of Rust that irks you so. That's fine. No one needs to learn or not learn any given tool.
- danuker 4y agoBeing able to learn C doesn't mean C's wordiness didn't irk me. It did. In addition to verbosity, C bothered me with mandatory types, undefined behavior and having to manage memory myself. Rust is not much better. It still has types and memory management. A lot[1]. I don't want to deal with that. The computer should figure it out. Not having to specify all that also translates generally to shorter programs, and this is why I appreciate terseness. [1] - https://www.brandons.me/blog/favorite-rust-function https://www.brandons.me/blog/favorite-rust-function