= Memento pattern
A design in which an originator creates an opaque snapshot of its state, a caretaker retains it, and the originator can later restore it. <Encapsulation> prevents the caretaker from depending on internal state representation. A memento must freeze the relevant state: references to mutable objects can require a <deep copy>, while immutable values can safely be shared. <Scala>'s access controls and <path-dependent types> can restrict snapshot construction and associate it with its originating instance.
Back to article page