News for hackers. Stuff that matters.
Re:Show HN: Algorithm Cookbook in Rust by cyber1 on Monday June 19, 2017 @02:46PM (#14589341)
"My other goal is to show developers that C++ and Java kinda suck" -- really?!
Re:Show HN: Algorithm Cookbook in Rust by jeeyoungk on Monday June 19, 2017 @07:49PM (#14591251)
Rust is one of my favorite programming language, and yet I learned how much I missed java after learning Rust. The fact that everything is dynamically dispatched and non-primitives are referential type allows you to program things without thinking too much. Plus, JIT & Hotspot can optimize these away - perform stack allocations for local objects and short-circuit dynamic dispatch for nonvirtual functions.

That said, my biggest Rust-gripe has been writing recursive / self-referential data structures. Borrow system is just not very convenient for that and you end up restructing the code to be a bit more Rust-friendly.

Re:Show HN: Algorithm Cookbook in Rust by sidlls on Monday June 19, 2017 @02:57PM (#14589421)
Yeah, it's a pretty poor way to represent Rust to an audience that is ostensibly it's target audience.
Re:Show HN: Algorithm Cookbook in Rust by Buttons840 on Monday June 19, 2017 @03:12PM (#14589540)
Any developer who can't name something that "kinda sucks" about their language probably isn't ready to learn a new language.
Re:Show HN: Algorithm Cookbook in Rust by sidlls on Monday June 19, 2017 @03:22PM (#14589622)
The quoted comment isn't about particular shortcomings in a language, it's a blanket pejorative, and it doesn't reflect well on the author's credibility.
Re:Show HN: Algorithm Cookbook in Rust by EbTech on Monday June 19, 2017 @04:11PM (#14590029)
Fair point, it's fixed now.
Re:Show HN: Algorithm Cookbook in Rust by freeordead on Monday June 19, 2017 @04:36PM (#14590246)
Would be a stronger argument if you had a better rating on CF :) As of now I will stick to the Petr / Egor philosophy.
Re:Show HN: Algorithm Cookbook in Rust by EbTech on Monday June 19, 2017 @04:43PM (#14590300)
What's their philosophy? I think Petr was using C# at some point.
Re:Show HN: Algorithm Cookbook in Rust by freeordead on Monday June 19, 2017 @04:51PM (#14590361)
Well I would say their philosophy first of all relies on strong tools. Intellij with CHelper plugin allows for simpler testing and also has incredibly powerful debugging as I am sure you have seen in their screencasts.

Also I think they sort of show the value of Java's simpler approach with everything being a reference in terms of writing code quickly. The alternative approach that C++ competitors use relies on a very specific style unlike what production code at say Google uses, with pointers used as sparingly as possible. With everything being a reference it is much easier to work with graphs for instance.

To me Rust goes even further into the C++ direction where it becomes more and more difficult to quickly write code that compiles. With Java I have no issue writing 100 lines and having everything compile the first time around, particularly with an editor like Intellij. With C++ even Clion struggles significantly with producing helpful info, simply due to the complexity of C++.

Anyway don’t have enough time to really eloquently think through all aspects of this. Also I was just kidding about CF rating, you are far better than me obviously.

Re:Show HN: Algorithm Cookbook in Rust by partycoder on Monday June 19, 2017 @06:54PM (#14591033)
It's not achieving it though. The code could be more idiomatic and the project could have a better file organization.
Re:Show HN: Algorithm Cookbook in Rust by EbTech on Monday June 19, 2017 @09:06PM (#14591543)
Suggestions are welcome; I'm still learning Rust.

To put context around my provocative comment earlier: I write C++ professionally. C++ is the right choice for my organization, though for purely historical reasons. In the long run, I think we'd all be better off if Rust or similar languages replaced their predecessors. So my comment came from a place of personal frustration, the same that led me to find Rust in the first place.

The old wording was too negative; I'm just excited to show that contest programming, which one might imagine to be hard to translate, is not only practical but indeed arguably nicer in Rust.

Re:Show HN: Algorithm Cookbook in Rust by freeordead on Tuesday June 20, 2017 @12:14AM (#14592148)
Just be careful to not adapt the michaelochurch approach. Very risky :)
Re:Show HN: Algorithm Cookbook in Rust by tormeh on Monday June 19, 2017 @05:33PM (#14590644)
It's a worthy cause. At HN we might all be aware that Java and C++ suck, but others might not know. Assuming others know what you do is a common cognitive bias. To us, this might be a slightly childish thing to have as a goal, but it might be a revelation to some readers.
Re:Show HN: Algorithm Cookbook in Rust by dsacco on Tuesday June 20, 2017 @09:20AM (#14594376)
> At Hacker News we might all be aware that Java and C++ suck, but others might now know. Assuming others know what you know is a common cognitive bias.

The irony here is astonishing.

I am a frequent commenter on HN and I rather like C++. I acknowledge its shortcomings without resorting to the tribalism that is marring the reputation of the Rust community.

Please don't assume that all of Hacker News has a homogenous perspective on the utility (or lack thereof) of extremely common languages like C++ or Java. I've said this before in threads like this and I'll say it again: one language does not need to win.

Re:Show HN: Algorithm Cookbook in Rust by steveklabnik on Tuesday June 20, 2017 @09:34AM (#14594461)
"One language does not need to win" is the majority position of the Rust community. Of course, it itself is not completely homogeneous either.
Re:Show HN: Algorithm Cookbook in Rust by dsacco on Tuesday June 20, 2017 @09:42AM (#14594502)
Oh believe me, I know the Rust community does not itself endorse this behavior (or mindset). I do believe the vocal minority that pushes that agenda actively harms the community; however, I appreciate your effort for clarification.
Re:Show HN: Algorithm Cookbook in Rust by tormeh on Tuesday June 20, 2017 @12:00PM (#14595659)
I'm not saying that Java or C++ are useless per se, just that they suck compared to many other options we have available.

Of course they both have tremendous utility, but so too does a 15 sqm house. Doesn't mean it doesn't suck.