News for hackers. Stuff that matters.
Re:TypeScript 5.2's New Keyword: 'using' by pavlov on Monday June 19, 2023 @06:09AM (#36389306)
Considering this limitation, I wonder if the syntax could have been something else than assignment. Like maybe:

  using getResource() as res;
Re:TypeScript 5.2's New Keyword: 'using' by kybernetikos on Monday June 19, 2023 @06:24AM (#36389404)
I agree. If it's assignment then it should work the same as assignment, otherwise it should have a different syntax.
Re:TypeScript 5.2's New Keyword: 'using' by pavlov on Monday June 19, 2023 @06:27AM (#36389418)
Also seems like there would be use cases where you don't even want to assign the result, you just want the destructor to run at the end of the scope. Something like:

  using someMutex.lock();
With the assignment syntax it's not obvious to me whether that's allowed.
Re:TypeScript 5.2's New Keyword: 'using' by carlhjerpe on Monday June 19, 2023 @10:55AM (#36391775)
You assign it to a variable that is then disposed of once it's out of scope?