Am I missing the point or is the “using” thing just a very over-engineered destructor that you can FORGET to call? It’s nothing like Python’s “with” that lets you define a scope for an object to be destructed early. If you forget, or simply don’t know that the object supports “disposal”, will the object simply never be disposed? Or will the TSC not compile if you leave out a “using” for a disposable object?

TSC should fail the build if it doesn't have the destruction interface, the scope is the scope the variable is initialized in/under. It's very similar to C#'s usage of using.

Edit: It's also a pending Stage 3 proposal for EcmaScript.

https://github.com/tc39/proposal-explicit-resource-managemen...