Re:Rust: A Critical Retrospective
by metaltyphoon on Thursday May 19, 2022 @01:41PM
(#31437749)
Isn’t that a good general practice todo? Exit early
[ Parent
| on HN ]
You'd be surprised. For every person that things exit early is good, you'll run into another that prefers a single exit. At worked at a C++ shop that preferred "single exit", and some methods with an ungodly amount of conditions just to make this possible. Ugh.
Re:Rust: A Critical Retrospective
by boolemancer on Friday May 20, 2022 @02:49AM
(#31444139)
In my experience, a preference for single exit comes from C where you always need to make sure to clean up any resources, and an early exit is a great way to have to duplicate a bunch of cleanup logic or accidentally forget to clean things up.
Of course, that's what goto is actually good for.