News for hackers. Stuff that matters.
Re:James Gosling Interview by dmux on Thursday August 12, 2021 @09:18AM (#28155912)
>He seems to be saying that TypeScript leads to faster code execution as TypeScript has types, but fails to understand that TypeScript still compiles to JS and the browsers run JS without types...

I'm not saying this is the case, but isn't there a greater opportunity to optimize TypeScript code over JavaScript due to the presence of types? Isn't this the same thing as a statically typed program being compiled into assembly (untyped) ?

Re:James Gosling Interview by darksaints on Thursday August 12, 2021 @09:43AM (#28156239)
There is a greater opportunity, but it hasn't happened in practice. And even with Typescript's types, I doubt that it would make much of a difference because the type system is deliberately not sound and the types can't really be relied on. Typescript is a great way of reasoning about a program, but it's not meant as a runtime execution type system.
Re:James Gosling Interview by srtjstjsj on Thursday August 12, 2021 @09:43AM (#28156242)
Yes. Another common example is that in languages without pointers, the lack of aliasing enables optimizations that are impossible for languages with pointers.

Also, C compilers generate efficient code by assuming undefined behavior cannot happen. (This sometimes corrupts buggy programs, because the type system can't guarantee undefined behavior isn't triggered.)

Re:James Gosling Interview by x-shadowban on Thursday August 12, 2021 @12:58PM (#28158730)
TS biases code to using objects of very consistent shapes, so the js runtime's assumption-based optimizations are deoptimized less frequently.