Adding Go's Defer to the TypeScript Compiler(healeycodes.com) |
Adding Go's Defer to the TypeScript Compiler(healeycodes.com) |
defer is the thing I miss the most coming from Go
Try X finally dispose of all resources. X, defer clean up X. Or how about just X and cleanup is done automatically, with the author of the resources deciding what is needed to clean X up.
It's way easier to use, much clear, less typing, more predictable runtime behavior.
RAII... terrible name, great concept!
There isn't any way to forget to drop a resource if you have RAII.