A Gopher Meets a Crab

42 points43 comments2 days ago
joshka

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 comments
saagarjha

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 comments
JKCalhoun

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

huqedato

Learning Go after five years of professional struggle with Rust was a relief; Go feels designed for humans to just get the job done. (not a Google fan!) I'll get a ton of downvote for this but it's ok.

show comments
RobotToaster

Was anyone else expecting OpenClaw over gopher protocol?

show comments
wiseowise

Still better than deciphering C++ soup of characters.

show comments
nothinkjustai

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 comments