[Tim] >>>> To my eyes, this is genuinely harder to follow, despite its relative brevity: >>>> >>>> while total != (total := total + term): [Antoine] >>> Does it even work? Perhaps if the goal is to stop when total is NaN, >>> but otherwise? [Chris] >> Yes, it does, because the first "total" is looked up before the >> rebinding happens. It's 100% unambiguous to the compiler... but still >> pretty unclear to a human. And I think the multiple use of 'total' is >> to blame for that. So I agree with Tim that this particular example is >> better in longhand. [Antoine] > "Better" is an understatement :-( Now that I understood it (thanks > for the explanation), Ah, sorry - I had no idea it was the "left to right evaluation" part you weren't seeing. Next time explain why you think something is broken? > the shorthand version appears completely bonkers. I wouldn't go that far, but I already said I wouldn't write it that way. However, without looking at real code, people are just flat-out guessing about how bad - or good - things _can_ get, no matter how confident they sound. So at least give me credit for presenting the _worst_ brief binding-expression example you've seen too ;-)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4