"Using" -- a poor choice of keyword. It has been used for many years in languages like C++, C# (and now Rust) for namespace manipulation. Using the same keyword to declare an object destructor becomes confusing.
For a language like Typescript which borrows so much of its syntax from C/C++ it would be best to either make the same syntax mean the same thing, or instead make up new syntax. Call it "with" or "defer", or something else instead.
Also the syntax "Symbol.dispose" to denote a symbol seems overly verbose. Why not use a single prefix character like Lisp/Ruby ":symbol".
It’s not, though the author and champion of the TC39 proposal is a Microsoft employee and has generally championed features that have a close analogue to those from C# (eg. cancellation tokens).
"with" was already taken by a misfeature of JavaScript, so… I too thought they were introducing something related to the "using" of C++, but the keyword does not seem too bad, in the context of a code, it's very readable. What would you suggest?
As for Symbol, it's a JavaScript feature. I bet it was introduced like this so symbols could be polyfilled, so adopted more easily, without making the lack of support a syntax error - i.e. no need to transpile this. A bit verbose, but bearable, and probably easier to parse for a human than a colon. Too much of such terse syntax rapidly makes the code harder to read and more difficult to look up for a novice, or possibly even for someone experimented..
Nah I remember back in 2012 when I wrote C# we used `using` to indicate "dispose of this as soon as it's out of scope". Like for filereaders or streamreaders, if I remember right.
For a language like Typescript which borrows so much of its syntax from C/C++ it would be best to either make the same syntax mean the same thing, or instead make up new syntax. Call it "with" or "defer", or something else instead.
Also the syntax "Symbol.dispose" to denote a symbol seems overly verbose. Why not use a single prefix character like Lisp/Ruby ":symbol".