News for hackers. Stuff that matters.
Re:Rust can be difficult to learn and frustrating, but it's ... by dman on Monday October 22, 2018 @11:02PM (#18280425)
I think Rust should stop looking at C++ as the becnhmark / comparison point for complexity. The expectations that developers have from languages has increased over time, and Rust itself has contributed to raising that bar.
Re:Rust can be difficult to learn and frustrating, but it's ... by steveklabnik on Monday October 22, 2018 @11:31PM (#18280536)
We don’t generally consider other languages as a measure of what complexity is “okay” or something, and are extremely aware of Rust’s complexity. Rust has a lot of requirements that directly lead to a lot of that complexity. But it’s neccesary, not incidental. Or that’s the hope, at least. Rust is also not perfect.
Re:Rust can be difficult to learn and frustrating, but it's ... by bb88 on Monday October 22, 2018 @11:47PM (#18280593)
A lot of (but not all) complexity is solved in C/Python/Java by throwing a data structure at the problem. But is it a fair statement to say that not all data structures will work in Rust? Or is it better to say that some data structures work better in Rust than others?
Re:Rust can be difficult to learn and frustrating, but it's ... by ovao on Tuesday October 23, 2018 @01:06AM (#18280845)
Writing certain data structures in safe Rust can be hard, but not impossible. I’m not aware of any data structures that simply cannot be written in Rust.
Re:Rust can be difficult to learn and frustrating, but it's ... by Tuna-Fish on Tuesday October 23, 2018 @04:15AM (#18281644)
Of course, since anything that can be written in C can be written in unsafe Rust.

Though, reading the post above yours, I was thinking more about the use of data structures than the implementation of them. In C++, when faced by the need to efficiently iterate through a data structure in different, incompatible orders, the tool of choice is often just to make intrusive linked lists with multiple next pointers per element. I think I've even once implemented something that was a priority queue (heap), two different lists and a tree at a same time.

While doing that in Rust is by no means impossible, it seems to me that the use of such a structure would be much more clumsy in Rust, to the point where I would try hard to solve the problem in some different way.

The languages are all turing-compatible anyway, so it's not about what can be done, it's about what approaches does the language make easy and promote. Overall I really like the kind of code idiomatic Rust tends to end up like.

Re:Rust can be difficult to learn and frustrating, but it's ... by bb88 on Tuesday October 23, 2018 @10:00PM (#18289090)
Thanks for the thoughtful post. I do have a question, that maybe you can answer?

> The languages are all turing-compatible anyway, so it's not about what can be done, it's about what approaches does the language make easy and promote.

Turing completeness is kinda besides the point. We probably wouldn't be talking about it on HN if it wasn't. :)

I guess what I'm wondering is does Rust encourage simpler but possibly slower data structures, or are there some complex data structures which are simpler to ensure safety than other simpler ones?

In other words, does Rust encourage simplicity at the cost of speed?

Re:Rust can be difficult to learn and frustrating, but it's ... by steveklabnik on Wednesday October 24, 2018 @10:07AM (#18292520)
As with all performance questions, the answer is “it depends.” For a look into this question, see http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performa...
Re:Rust can be difficult to learn and frustrating, but it's ... by bb88 on Wednesday October 24, 2018 @10:09PM (#18298072)
Hey thanks for the response.

I'm happy that rust has a good set of performant data structures, but on the other I feel like it's too soon to say Rust is the big winner here as the author does. I've been very skeptical on fantastical claims by language promoters.

But taking the pain out of making common data structures is a good start.

Re:Rust can be difficult to learn and frustrating, but it's ... by steveklabnik on Thursday October 25, 2018 @10:50AM (#18301298)
I think if you'll look into the author's credentials he is far from a "language promoter."