Live data from Hacker News

Static TypeScript: A Static Compiler for the TypeScript Language

microsoft.com

21–30 of 57 posts

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#21

This language is quite striking! TypeScript is a superset of JS but here we're going from the other direction. Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. No Object (!!), no Date, TypedArray, RegExp, almost all the mainstays are gone. It's Java 1.0: static offsets and vtables. This feels like the beginning of TypeScript throwing its weight around. It has the momentum to su…

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

Typescript has a unique typesystem that embraces duck typing. This is quite different to how you would type e.g. a scala program. C++ adds a load of additional burden on the programmer (memory) and has a relatively weak typesystem. Clearly Typescript has a niche, has familiarity to subset of programmers, so there are plenty of reasons for this to have its place.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#22

This language is quite striking! TypeScript is a superset of JS but here we're going from the other direction. Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. No Object (!!), no Date, TypedArray, RegExp, almost all the mainstays are gone. It's Java 1.0: static offsets and vtables. This feels like the beginning of TypeScript throwing its weight around. It has the momentum to su…

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

I am not sure where you are going with that. C++ is largely popular and enduring for the same reasons as Java: institutionalization (taught in school).

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#23

Yes! I was waiting for this so long, Typescript is the most flexible typed OOP language and it's way more than just a JS successor.

Only that this subset has no objects and is therefore not a OOP language anymore (?)

It does have objects:

STS has at runtime four kinds of unrelated object types:

1. a dynamic map type has named (string-indexed) properties that can hold values of any type; 2. a function (closure) type; 3. a class type describes instances of a class, which are treated nominally, via an efficient runtime subtype check on each field/method access, as described below; 4. an array (collection) type.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#24

This language is quite striking! TypeScript is a superset of JS but here we're going from the other direction. Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. No Object (!!), no Date, TypedArray, RegExp, almost all the mainstays are gone. It's Java 1.0: static offsets and vtables. This feels like the beginning of TypeScript throwing its weight around. It has the momentum to su…

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

C++ is the biggest cancer in the industry. I can't really understand how people can easily say its name. A C++ programmer needs to understand not only language syntax but also underlying operating system and its internals. This is completely different job and therefore needs completely different expertise. I don't even want to mention hardware limitations, cpu architectures, etc. So, don't use C++. It is not mainstream anymore and hopefully it will be a thing of past.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#25
From the title it would seem it is boiled down to a completely statically-typed language, but it isn't.

e.g. type casts are no-ops. Instead, every object access is type-checked at runtime. `any` still exists and for unions and complex types it still performs full lookup by name (instead of RTTI/tagged unions or such).

So it's not really a static language, but a cut-down JavaScript runtime that instead of optimizing objects with hidden classes at runtime, does similar thing with vtables ahead of time.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#26
post #24

Earlier quoted context omitted.

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

C++ is the biggest cancer in the industry. I can't really understand how people can easily say its name. A C++ programmer needs to understand not only language syntax but also underlying operating system and its internals. This is completely different job and therefore needs completely different expertise. I don't even want to mention hardware limitations, cpu architectures, etc. So, don't use C++. It is not mainstre…

Not mainstream?!?

I guess we have been using different platforms, so is the bubble of web development.

Just for your education, Python ML research, is just glue for GPGPU libraries written in C++, NVidia nowadays specifically targets their GPGPU designs to match C++ semantics, Apple, Google and Microsoft use C++ for their drivers, Metal shaders use C++, AAA game industry breathes C++, Fintech uses a mix of Java/.NET and C++, LLVM and GCC, the beloved FOSS compiler stacks are written in C++, AUTOSAR requires C++14, Arduino Sketch is actually C++,…

C++ might have a couple of flaws, not being mainstream is certainly not one of them.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#27

Earlier quoted context omitted.

Only that this subset has no objects and is therefore not a OOP language anymore (?)

It does have objects: STS has at runtime four kinds of unrelated object types: 1. a dynamic map type has named (string-indexed) properties that can hold values of any type; 2. a function (closure) type; 3. a class type describes instances of a class, which are treated nominally, via an efficient runtime subtype check on each field/method access, as described below; 4. an array (collection) type.

Ok, I did not read the specifications yet and just refered to the other comment. But your quote gives no indication of (prototyp or classical) inheritance?

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#28

This language is quite striking! TypeScript is a superset of JS but here we're going from the other direction. Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. No Object (!!), no Date, TypedArray, RegExp, almost all the mainstays are gone. It's Java 1.0: static offsets and vtables. This feels like the beginning of TypeScript throwing its weight around. It has the momentum to su…

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

Definitely painful. After trying to get a team to adopt and gradually type a large codebase for the last 2.5 years I can say that gradual typing is a dream. In practice you write more code than you end up typing as you go and the project is never 100% complete.

If something gets typed as `any` all bets are off and there are no benefits. So people don't end up running the type checker during development anyway. Which defeats the purpose.

There are small places where it is useful -- some developers on the team had never used a type system before and found that it helped them eliminate errors from their code before they even ran the program.

But overall... agree, Typescript/Flow -- they were great experiments and useful -- but I'd rather see ways for us to adopt better languages. Elm, Purescript, Haskell, F# -- Javascript is great for projects of a certain size... but once you get to a large team and many tens-of-thousands of lines of it... discipline will only get you so far.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#29

This language is quite striking! TypeScript is a superset of JS but here we're going from the other direction. Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. No Object (!!), no Date, TypedArray, RegExp, almost all the mainstays are gone. It's Java 1.0: static offsets and vtables. This feels like the beginning of TypeScript throwing its weight around. It has the momentum to su…

Subsets of TypeScript are an interesting idea. If you could remove mutation and push imperative APIs into a library that calls you, you might wind up with something like Elm.

Re: Static TypeScript: A Static Compiler for the TypeScript Language

#30

Earlier quoted context omitted.

> Make a language that is only the TypeScript extensions to JS, and drop all the JS parts. So? Is there a reason left then to use Typescript instead of C or C++? I cannot think of one. Especially for education you better use a real language that will stay for more than 10 years at least. Microsoft is doing a great job taking over the Javascript community, and now this.., would love to see their hidden agenda. IMAO Ty…

I am not sure where you are going with that. C++ is largely popular and enduring for the same reasons as Java: institutionalization (taught in school).

That's simply not true.

I'm not aware of any place where C++ is taught. (And in fact C++ programmers are very hard to find.)

C is very common and anybody with even a bit of format education has been exposed to C.

Then you get people who know a bit of C and throw in a couple 'class' and a couple 'cout', and call it 'C++' for some reason.

Which is wrong, obviously.

Post reply on HN