 This originated in C++ as the ScopeGuard class, by Andrei Alexandrescu and Petru Marginean in 2000,
 with improvements by Joshua Lehrer, and has direct language support in D via the codice_20 keyword (ScopeGuardStatement), where it is one approach to exception safety, in addition to RAII (see below).It has also been included in Go, as the codice_21 statement.This approach lacks encapsulation – one must explicitly match acquisition and release – but avoids having to create an object for each resource (code-wise, avoid writing a class for each type of resource).