logoalt Hacker News

A Gopher Meets a Crab

42 pointsby radimmlast Thursday at 6:30 AM39 commentsview on HN

Comments

joshkatoday at 7:35 AM

The weird-looking Rust isn’t really Rust being weird, it’s the type telling the truth.

   Result<Option<Result<Message, WsError>>, Elapsed>
That’s three independent “not the happy path” channels: timeout, stream closed, and websocket error.

The nicer version is not a cleverer match. It’s choosing a domain error shape and converting into it one layer at a time:

    let timed = tokio::time::timeout(duration, receiver.next()).await;
    let next = timed.map_err(|_| ReceiveError::Timeout)?;
    let item = next.ok_or(ReceiveError::Closed)?;
    let msg = item.map_err(ReceiveError::WebSocket)?; 
The ugly line is what happens when you have not decided where to normalize the shape yet.
show 3 replies
JKCalhountoday at 11:40 AM

From vibe coding we now seem to have… tray-table coding?

saagarjhatoday at 9:13 AM

I feel like having an LLM write code in a language you aren't familiar with and then inspecting the results is kind of like hiring someone to speak Spanish for you and then being confused at the weird words they are using. Like, what would make you want to do this?

show 5 replies
RobotToastertoday at 8:07 AM

Was anyone else expecting OpenClaw over gopher protocol?

show 2 replies
wiseowisetoday at 9:56 AM

Still better than deciphering C++ soup of characters.

show 1 reply
nothinkjustaitoday at 8:55 AM

Um? Person vibe codes Rust. Output is stupid. The conclusion is either

a) Vibe coding produces bad code

b) Rust is weird

Somehow we’re supposed to accept b as the answer? Give me a break….

show 1 reply