v131 · javascript
Explicit resource management (sync)
This feature addresses a common pattern in software development regarding the lifetime and management of various resources (memory, I/O, etc.). This pattern generally includes the allocation of a resource and the ability to explicitly release critical resources.
concepts
-
using
using statement for deterministic resource disposal.
-
DisposableStack
Batch N resources into a stack and dispose them in reverse order. Includes
move()ownership transfer. -
File handle lifecycle
Side-by-side try/finally vs
usingwith a mock file API and a leak counter. Throw mid-read and watch the difference. -
Build your own disposable
A stopwatch class implementing
[Symbol.dispose](). Feature-probe panel shows whether your build exposes the new symbols.
why it shipped
This feature addresses a common pattern in software development regarding the lifetime and management of various resources (memory, I/O, etc.). This pattern generally includes the allocation of a resource and the ability to explicitly release critical resources.