Delphi – Defer defines the “postpone procedure” pattern to execute code at the end of a method
Posted by jpluimers on 2018/09/06
Last year, I stumbled upon [WayBack] Defer defines the “postpone procedure” pattern, this postpone should schedule a “procedure: TProc” to run it after the end of the caller method… – Cesar Romero – Google+ that points to this repository:
Some people like this usage of the RAII pattern, but I do like it even though I do not use it very often. The implementation better than my TAnonymousMethodMemento in Delphi: a memento that executes any code at end of method for various reasons:
- it has unit tests
- the returned interface can be chained to add more deferring procedures
Now the documentation could use more English (some of it is in Portuguese).
–jeroen
Leave a comment