Sean McArthur

Sean McArthur

@seanmonstar.com

Open Source maintainer of the rust-lang @hyper.rs. More at seanmonstar.com

1.4K followers46 following162 posts

I've always insisted on _optimizing for reading_. And as many use LLMs make writing faster, there's even less reason to pick shorter but more complex.

Structs are free. They don't result in auto boxing. So, divide up your structs by how the fields relate to each other. Then it's much easier to borrow one field than to wish for some complex syntax to borrow many.

The top advice given to anyone wanting to get better at writing, besides just writing, is to _read_ more. Especially good writing. Because we imitate that which we experience more of.

They're a lot like RFCs. With some tweaks from lessons learned. Making maintenance more repeatable, less in one mind. The writing is the thinking. It documents the why. A sustainable personnel of hyper.

Imagine someone tells you to get them a rock. You go find one, bring it back, and they reply 'no, not that rock'. They didn't know exactly what they wanted, but they knew yours wasn't it.

When writing, I always start by dumping a detailed outline with points and subpoints. And then, ugh, I feel a wall. How do I turn this into prose? I ask an LLM to try, I look at the ablated text, and I hate it. No, definitely not that rock. More like this.

New #rustlang h2 release v0.4.16 out today! - Enforce limits on tiny DATA frames. (GHSA-q83h-524g-xf6h) - Significant performance improvements: IO contention and HPACK decoding. - Several smaller fixes. Worth an upgrade! github.com/hyperium/h2/...

github.comRelease v0.4.16 路 hyperium/h2What's Changed fix: error instead of busy-looping when write returns Ok(0) by @ArniDagur in #921 Revert "perf(header): optimize HeaderValue creation via zero-copy sharing" by @0x676e67 in #924 fix...

How about a trait instead? (I suggested it in the tracking issue a long time ago, but it's lost in the noise). Rust traits are awesome. They can be implemented on any other type, even primitives, without them needing to cooperate.

A trait could allow us to write `5.seconds()`, or `200.milliseconds()`, etc. I think this is much better. I would rather this exist instead. Maybe `std::time::TimeUnits`, or pick a better name, doesn't matter which, just that it's easy to import.

LLMs write way _way_ too much. I don't know if you understood it enough for me to ask questions back. They don't use reasoning, so is it real? If you didn't care enough to write it, do I care to read it?

I'm torn when I receive LLMed reports. Initially, I really don't want to read all that. But at the same time, my mind nags me; something's broken and I should fix it for everyone. If it makes it easier for someone to report a bug, that's a pro, I guess.

If you choose to communicate with me, all I ask is that you use your own words. Bug reports and issues. Pull request descriptions and especially review comments. This isn't new, but I wanted a link of my own.

Sean McArthur reposted

This is one reason why it could be a better practice to return an `impl Iterator` instead of `&[T]`. The latter freezes you in place to always storing the data in consecutive memory. (Such as `String::as_bytes()`.)

View types might help too, like `Ref<'_>`. Returning a reference requires the data already exist in that shape in `self`. You can't change its shape in the accessor and return a reference to _that_.

As a library maintainer, it's common to receive requests from users to add a "simple accessor". The data is _right there_. But that accessor can end up revealing internal representation details that you can no longer change.

New release of #rustlang hyper out today, v1.11.0! 馃殌 Several big bug fixes. - Buffered data fully flushes even when half closed - Enforce backpressure in HTTP/2 Upgraded bodies (like CONNECT) - Start of a strict Clippy allowlist - 10 contributors, 7 of them new! 馃 github.com/hyperium/hyp...

github.comRelease v1.11.0 路 hyperium/hyperFeatures rt: add ReadBufCursor::initialized_unfilled() method (#4115) (ccc1e850) Bug Fixes http1: discard content-length header when received before transfer-encoding (#4124) (540fff91, closes ...

A public, exhaustive, flat `enum` could choose differently. But those look more like a `kind()`. If you have private error details, I don't think they make sense for comparing.

Errors might have internal details that don't make sense to compare. Like positional data, or a source chain. Even if you don't have those details yet, committing to a public API of `PartialEq` can restrict you from internal refactoring.

The common reason to want this is for testing purposes. People want to assert an error case matches what they expect. But that doesn't need equality. `matches!` , `kind()`, or `is_*()` patterns fit better.

Sean McArthur reposted