auto var = hairilyAllocatedObject(); scope(exit) cleanupObject(var); sock.send("<html><head></head><body>"); scope(exit) sock.send("</body></html>");
logln("Digraph D {"); scope(exit) logln("}"); SDL_LockSurface(display.surface); scope(exit) SDL_UnlockSurface(display.surface); auto dg = { performComplexExitCleanupDuty; }; scope(exit) dg(); .... dg = dg /apply/ (proc dg) { moreCleanup; dg(); }; .... /* Half a dozen different ways of leaving the function go here */ auto backup = var; var = newValue; scope(exit) var = backup;