logoalt Hacker News

layer804/03/20252 repliesview on HN

When I first read the K&R book, that syntax made perfectly sense. They are building up to it through a few chapters, if I remember correctly.

What has changed is that nowadays most developers aren't doing low-level programming anymore, where the building blocks of that expression (or the expression itself) would be common idioms.


Replies

card_zero04/03/2025

Yes, I really like it, it's like a neat little pump that moves the string from the right side to the left. But I keep seeing people saying it's needlessly hard to read and should be split over several lines and use += 1 so everyone can understand it. (And they take issue with the assignment's value being used as the value in the while loop and treated as true or false. Though apparently this sort of thing is fine when Python does it with its walrus operator.)

dmoy04/03/2025

That's a very good point

I'm now wondering what the Rust lang equivalent of K&R is, so I can go do that in a more modern context.