Hacker News new | ask | show | jobs
by TJSomething 1101 days ago
Based on my reading of the spec, you can't actually return a resource, since the disposal semantics need to map exactly to calling [Symbol.dispose] in a finally block at the end of the current block. Also, unlike C#, you can have multiple using statements in the same block, which will be disposed of in LIFO order.
2 comments

You can have multiple using statements over the same block in C#.
You can create a resource without “using” it immediately, though.