News for hackers. Stuff that matters.
Re:Why is Rust difficult? by majewsky on Monday January 22, 2018 @04:39AM (#16203123)
> In terms of correctness, I've never heard claims about improving security issues

I would argue that the rest of your paragraph talks about how Rust (indirectly) improves security issues.

> As for compiler errors not helping you understand the problem, I have yet to encounter a compiler that does that.

Try misplacing a { in an average LaTeX document. But don't say that you haven't been warned. ;)

Alternatively, write some C++ code that uses std::map<std::string, std::string> or something like that incorrectly, and marvel at the page-long exceptions with all the default template arguments expanded into an unreadable mess.

> Also, the Rust compiler appears pretty vibrant with lots of improvements being made to help with user friendliness, so it's possible that further improvements in inference might reduce the problem spots (it's already pretty magic to me).

I also recently got into Rust (coming from Go), and the thing I miss most is `gofmt`. Is there a standard tool-enforced coding style for Rust that the community agrees on, in the same way that the Go community has by and large agreed on gofmt?

Re:Why is Rust difficult? by vlovich123 on Monday January 22, 2018 @06:34AM (#16203595)
> I would argue that the rest of your paragraph talks about how Rust (indirectly) improves security issues.

I think perhaps I didn't communicate my meaning clearly enough. Rust does significantly reduce the risk of a certain class of security problems (reduce not eliminate since it's highly unlikely you'll have 0 unsafe{} blocks anywhere in your dependency chain). That's not disputable since that's part of the language design. That's certainly an advantage it has over C/C++. However, security is far more than just memory safety & I have read nowhere that writing more secure code is a design goal for Rust (I'm not even sure yet such a thing is possible).

> Try misplacing a { in an average LaTeX document. But don't say that you haven't been warned. ;)

> Alternatively, write some C++ code that uses std::map<std::string, std::string> or something like that incorrectly, and marvel at the page-long exceptions with all the default template arguments expanded into an unreadable mess.

I agree 100%. I think perhaps you misread what I wrote? I said I have not encountered a compiler where the errors helps you understand a language.

> Is there a standard tool-enforced coding style for Rust that the community agrees on, in the same way that the Go community has by and large agreed on gofmt?

rustfmt

Re:Why is Rust difficult? by manveru on Monday January 22, 2018 @06:54AM (#16203708)
I think Elm has some of the best engineering around that: http://elm-lang.org/blog/compiler-errors-for-humans and http://elm-lang.org/blog/compilers-as-assistants

While it's also not perfect or can correctly identify all possible syntax/intent errors, it's a valuable tool to learn the language nonetheless.

Re:Why is Rust difficult? by aplanas on Monday January 22, 2018 @05:05AM (#16203234)
> Is there a standard tool-enforced coding style for Rust that the community agrees on, in the same way that the Go community has by and large agreed on gofmt?

https://github.com/rust-lang-nursery/rustfmt

And is planned to be distributed with the compiler and the cargo stack by default

Re:Why is Rust difficult? by DougBTX on Monday January 22, 2018 @05:01AM (#16203216)
Re:Why is Rust difficult? by johnnyanmac on Monday January 22, 2018 @06:22AM (#16203527)
Ugh, C++ template errors, the bane of my existence (and why I personally avoid using anything beyond dead-simple ones unless I have to interface with STL).

Only thing worse are Java generics, if only because they literally tried to tack them in 10 (heck, getting close to 15 years now) years ago and we are still feeling the consequences of those design choices today, (unless Java 8+ made major fixes to this. Haven't used it in enough detail to make a judgement).

Re:Why is Rust difficult? by jcelerier on Monday January 22, 2018 @07:17AM (#16203809)
template errors blurb a big wall of text, but if you know how to read it it only takes a few second to find in your code where your problem is. You generally just have to look at the "required from here" (in clang and gcc at least) message which points to your own code 9 times out of ten.

https://my.mixtape.moe/xdkchm.webm

Re:Why is Rust difficult? by timClicks on Monday January 22, 2018 @04:55AM (#16203194)