News for hackers. Stuff that matters.
Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Thursday January 25, 2024 @07:27PM (#39137407)
There’s a small message contained in that unnecessarily long post - that maybe a popular library used for HTTP in Rust could use less unsafe.

There was no need for this half mocking, half condescending tone. If the author wanted an explanation for a technical decision, they could open an issue and have a conversation like an adult. Instead we’re left with their speculation that leads nowhere. They cry about the existence of some unsafe code, but don’t actually put in the effort to figure out if it can lead to a real problem like unsoundness. And somehow the title implies that they’re saying something profound about the entire rust ecosystem when they just looked at one library. It’s just innuendo, as far as I could tell.

Here’s a post by the maintainer of hyper about what they accomplished in 2023 and what they hope to accomplish in 2024 - https://seanmonstar.com/blog/2023-in-review/

If this work interests you, or you depend on hyper in production like many companies do, then consider sponsoring them! Or maybe you could give back to the commons by submitting PRs that fix issues you’ve found. Or even a good bug report would be appreciated.

But not this kind of article. This article helps no one and does nothing constructive. We all benefit from the work that open source maintainers put in. They have it hard enough without having to read low effort posts trashing their work. Be better.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by lmm on Thursday January 25, 2024 @07:35PM (#39137470)
> If the author wanted an explanation for a technical decision, they could open an issue and have a conversation like an adult.

Opening an issue comes across as a whole lot more aggressive to me. That implies that they owe you an explanation or you want them to change their code.

> They cry about the existence of some unsafe code, but don’t actually put in the effort to figure out if it can lead to a real problem like unsoundness.

unsafe might as well be unsound. The key benefit of Rust is supposed to be better memory safety than C; if everything is using unsafe, why bother?

> Here’s a post by the maintainer of hyper about what they accomplished in 2023 and what they hope to accomplish in 2024 - https://seanmonstar.com/blog/2023-in-review/

Ok, and that doesn't mention "unsafe" once - no justification for why it's used, much less a plan to reduce or eliminate it.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Thursday January 25, 2024 @07:44PM (#39137550)
> Opening an issue comes across as a whole lot more aggressive to me. That implies…

It implies nothing. You can politely open an issue and ask why HeaderMap is used instead of HashMap. As long as you’re polite, it’ll be fine.

> unsafe might as well be unsound.

Oh boy, hope you don’t open Vec in the standard library. It can’t be implemented without unsafe and it’s used by almost all Rust programs. I guess every program is unsound, according to you?

> Ok, and that doesn't mention "unsafe" once

Nor does it need to. Just because OP decided this is a problem doesn’t mean it actually is a problem. Find unsoundness and then you have something worth discussing.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by lmm on Thursday January 25, 2024 @10:35PM (#39138635)
> It implies nothing. You can politely open an issue and ask why HeaderMap is used instead of HashMap. As long as you’re polite, it’ll be fine.

I have direct personal experience that opening an issue to politely ask this kind of design question is not always fine.

> Oh boy, hope you don’t open Vec in the standard library. It can’t be implemented without unsafe and it’s used by almost all Rust programs. I guess every program is unsound, according to you?

Based on past experience with LLVM undefined behaviour, yes, I think it's highly likely that every existing nontrivial Rust program is unsound in current Rust. But "depends on a standard library class that is currently implemented unsafely" will be much easier to fix in the future than "uses unsafe itself".

> Nor does it need to. Just because OP decided this is a problem doesn’t mean it actually is a problem. Find unsoundness and then you have something worth discussing.

Again, why use Rust at all if that's how you feel?

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Friday January 26, 2024 @02:02AM (#39139646)
You have no idea what you’re talking about. You’re so confidently incorrect about Rust that there’s no point even trying to educate you. Good day.
Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by dang on Monday January 29, 2024 @01:32AM (#39173389)
Please don't post like this. We have to ban such accounts and I don't want to ban you.

See https://news.ycombinator.com/item?id=39173369 for more.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by timeon on Friday January 26, 2024 @06:15AM (#39141348)
> The key benefit of Rust is supposed to be better memory safety than C; if everything is using unsafe, why bother?

Is Hyper all contained inside unsafe block? As far as I know it is not. So even if there is some unsafe code it is not same as writing it in C.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by lmm on Friday January 26, 2024 @08:39PM (#39151460)
Apparently even quite basic things like splitting a string are done in unsafe code. So it sounds like while it may not be 100% unsafe, most of it is.
Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by mrkline on Thursday January 25, 2024 @07:35PM (#39137468)
The article got me in touch with one of the hyper devs, and we had a very friendly conversation that taught me a lot.

If questioning some design decisions and calling a marketing blurb a little disingenuous is mocking and condescending, they didn't seem to think so.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Thursday January 25, 2024 @07:39PM (#39137508)
They told you they enjoyed your article? Or did you just infer that because they engaged politely?

All of my criticisms about your article still stand. It contributed nothing worthwhile, but I’m happy it got you your 15 minutes on HN.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by Scramblejams on Thursday January 25, 2024 @08:21PM (#39137812)
> It contributed nothing worthwhile, but I’m happy it got you your 15 minutes on HN.

That is a very rude dismissal, followed by a bad faith implication of the author's motivations. You can do better.

I got something worthwhile out of it. I'm learning Rust and, like the author of the blog post, tend to value safety (simplicity hopefully being a contributor to that) over that last bit of performance. I was actually looking over the source of some of the libraries I'm considering using, am concerned about some things I found, didn't know about ureq, now I do, and I think it's going to fit my needs.

Thanks, mrkline!

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by worik on Friday January 26, 2024 @02:42AM (#39139842)
I got a lot out of it too.

I have been using Rust, casually, for about eight years.

Sometimes in Rust it is hard to find simple things that solve simple problems.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Friday January 26, 2024 @03:10AM (#39139992)
The author put the absolute bare minimum of effort into this article. He condescendingly points out that hyper uses patterns and code that could be pulled from stdlib.

If he had had a conversation with the maintainer he could have found out and told us. Turns out he asked after writing this. Hyper was written before those pieces were added to the stdlib. Changing it would simplify the codebase, but there’s always a risk of breaking a mature, battle tested codebase. See how this new information completely changes the tone of the article?

Anyway, the crate is being actively maintained. It’s possible the author will look into making these improvements at some point. Until then the entire community can continue to benefit from a battle tested, performant, secure http lib.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by mrkline on Thursday January 25, 2024 @07:45PM (#39137555)
Turns out we regularly play flight sims together on weekends, but didn't know about each others' software misadventures - small world, isn't it?

If the reason I blogged about my coding hobby was to "get my 15 minutes on HN", I would be a deeply unhappy person.

Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by nindalf on Thursday January 25, 2024 @08:00PM (#39137664)
I’m happy for you. Do better next time. Good day.
Re:Unsafe at Any Speed: Tradeoffs and Values in the Rust Eco... by dang on Monday January 29, 2024 @01:29AM (#39173369)
You broke the site guidelines badly and repeatedly in this thread, for example in your aggressive comments to the article author, and in https://news.ycombinator.com/item?id=39139646 which was really totally unacceptable.

This is not cool.

You're a good contributor, and I appreciate that you don't do this all the time, but we've also had to warn you multiple times about this kind of thing in the past. If you'd please review https://news.ycombinator.com/newsguidelines.html and stick to the rules when posting here, we'd appreciate it.