Adding Go's defer to the TypeScript Compiler
- I wanted to see how difficult it would be to add Go's defer statement to the TypeScript compiler, but by the time I finished I was convinced it probably shouldn't exist.
- In Go, the defer statement delays the execution of a function until the surrounding function finishes.
- It's most commonly used to keep resource acquisition and cleanup together, like acquiring a semaphore:func withSemaphore(ctx context.
Unverified
- I wanted to see how difficult it would be to add Go's defer statement to the TypeScript compiler, but by the time I finished I was convinced it probably shouldn't exist.
- In Go, the defer statement delays the execution of a function until the surrounding function finishes.
- It's most commonly used to keep resource acquisition and cleanup together, like acquiring a semaphore:func withSemaphore(ctx context.
Sources: Healeycodes