Go and Swift have a dedicated defer keyword which allows the programmer to specify code which should run when leaving the current scope, irrespective of errors. F# supports a similar pattern with IDisposable and the use keyword, but this requires either defining a class definition or object expression and the extra syntax can make the code less expressive. This snippet defines a simple helper function called "defer" to remedy the situation.
2 people like thisPosted: 9 years ago by Anton Tcholakov
An event that can defer publication of certain values until a later time, or drop them entirely.
0 people like thisPosted: 5 years ago by Christer van der Meeren