News for hackers. Stuff that matters.
Re:TypeScript 5.2's New Keyword: 'using' by jasonjmcghee on Monday June 19, 2023 @11:48AM (#36392445)
One way you could think of it is, what if you’re using a library and it has a method supporting “using” functionality.

Now you can just call “await using foo(…)”, rather than the try/finally pattern, and get the automatic dispose call on leaving scope.

Kotlin has “use” with a similar effect, and i much prefer it over try/finally. Might be worth checking it out too.

There are no comments on this comment yet.