The D Language has scope(exit), instead of defer. Example:
scope(exit) writeln("3");
writeln("1");
writeln("2");
Output: 1
2
3 scope(exit) writeln("3");
writeln("1");
writeln("2");
Output: 1
2
3