References are like jumps
2024-05-16 16:31:43.970022+02 by
Dan Lyke
2 comments
I have been thinking a lot about things like "Do I need to learn Rust?", and ... I'm beginning to think maybe I don't?
References are like jumps:
Unfortunately, most people seem to have taken the wrong lesson from Rust. They see all of this business with lifetimes and ownership as a dirty mess that Rust has had to adopt because it wanted to avoid garbage collection. But this is completely backwards! Rust adopted rules around shared mutable state and this enabled it to avoid garbage collection. These rules are a good idea regardless.
I'm thinking about how I religiously avoided goto
until Tom Duff pointed out how silly my code looked with all of those nested error checks. Maybe they're not a good idea regardless, and the reason we're not all using functional languages today is that trying to build programs that way just doesn't work very well?
I dunno, I'm kind of in a contrarian mood this morning...
[ related topics:
Weblogs Software Engineering Work, productivity and environment Boats Machinery
]
comments in ascending chronological order (reverse):
#Comment Re: References are like jumps made: 2024-05-16 20:32:08.19773+02 by:
markd
I was loaned to a team (big Mac C++ app using trendy design patterns in the mid 90s), and was given the
task to integrate the library for decompressing the old compressed file format. It was a pure-C API, and led
to very clean code using goto-based cleanup.
The tech lead of the project was a Purist who was known to rewrite anybody's code at any time, and decided
goto was A Bad Thing and rewrote it without my knowledge.
Then I got bug reports from QA: "this doesn't work". Turns out the rewrite (double the lines of code, fancy
C++ exception handling, etc), Just Didn't Work. I gleefully reverted the rewrite back to the working version.
#Comment Re: References are like jumps made: 2024-05-16 20:33:32.701765+02 by:
markd
In the three editions of Advanced Mac OS X Programming, I intentionally used goto-based error handling
when I could just to tweak and annoy folks. "But goto is bad!" "fair enough. Rewrite this to not use goto, and
if it's better I'll use it". And it never was better.