[PATCH 2 of 5] lazymanifest: simplify cleanup at end of iteration
mpm at selenic.com
Thu Mar 12 17:49:38 CDT 2015
On Wed, 2015-03-11 at 16:14 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1426105596 25200
> # Wed Mar 11 13:26:36 2015 -0700
> # Node ID 7daaf234ddc08ee8dd171a6c2d3347e0caf1632e
> # Parent 0709db5b7ee275833b41b89feab59625dca28c7a
> lazymanifest: simplify cleanup at end of iteration
> When the iterator has been exhausted, there is nothing to clean up, so
> return early and simplify the remaining code.
I actually prefer the goto pattern. It makes maintaining code with
multiple exit points and (especially nested) resource unrolling much
more manageable. And since there's always a risk we'll add new exit
points here, I'd rather not take a step back here.
See here for a better example of the pattern:
And see here for a discussion (chapter 7):
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel