| “I can't believe the C standards committee is entertaining this.” Hey, standards committee’s gotta eat. 'defer'? I occasionaly use it in Swift to clean up resources; s’okay there, I guess, though I’m not convinced it’s better than Python’s 'with' block. But in C? One of C’s few distinguishing strengths is that the language is relatively† small and stable, and well understood. For that kind of cleanup there is already 'goto', which again is small, stable, and well understood. I just used it for that the other day: it works, it’s fine; I’m a grown-up. Yeah, sure, 'defer' is “safer” and “more elegant”… did we mention this is C? That ship sailed fifty years ago. Don’t try to make C into something it’s not: that’s C++’s job so go fill your boots there instead. I just posted Tony Hoare’s excoriation of ALGOL68 the other day, but clearly it’s needed again: http://zoo.cs.yale.edu/classes/cs422/2011/bib/hoare81emperor... Simplest solution: track down the ruddy C standards committee and beat them in the head with a leather-bound copy of Zawinski's Law (wrapped around a large gold brick), till either they’re dead or they leave C be. It does what it was designed to do, and that along is reason enough not to dick with it just because they’re bored and struggling to justify their continued existence. The only thing C needs to do is keep on working. That will only get harder the more crap they pile on top. A good artist knows when to stop. Which brings us to… “panic/recover” K&R give us strength! Tell these frustrated wannabe language designers to go make their own damn language, instead of screwing up someone else’s! Okay, now I’m done. And get off my lawn! |
[1] https://news.ycombinator.com/item?id=22866288
[2] https://news.ycombinator.com/item?id=24454369