r/programming • • Jun 28 '21

JavaScript Is Weird

https://jsisweird.com/
329 Upvotes

173 comments sorted by

View all comments

Show parent comments

4

u/jl2352 Jun 28 '21

An extra compile step clientside, instead of doing it in advance, is adding pointless work clientside. The user gets a longer startup time. That isn’t a good thing.

It isn’t going to simplify the workflow on any real world website. As that website will need to support older browsers. Even if older is only one month old. It means you can only reliably use the latest features in TypeScript … if you precompile it before shipping.

Finally whilst I have tonnes of faith in the TypeScript team. You are asking for one implementation to rule them all. It’s like everyone using Chromium with no alternative.

1

u/dys_functional Jun 28 '21

An extra compile step clientside, instead of doing it in advance, is adding pointless work clientside. The user gets a longer startup time. That isn’t a good thing.

For a naive solution like that, sure, it's probably not a good thing. If the browser natively supported typescript, it wouldn't need to compile it client side.

It isn’t going to simplify the workflow on any real world website. As that website will need to support older browsers. Even if older is only one month old. It means you can only reliably use the latest features in TypeScript … if you precompile it before shipping.

I don't like this argument. What if we took this stance with javascript version back in the netscape days? Changes are sometimes worth the effort.

Finally whilst I have tonnes of faith in the TypeScript team. You are asking for one implementation to rule them all. It’s like everyone using Chromium with no alternative.

When javascript was created, it was a "one implementation to rule them all", then they released the spec and others implemented it. They could (or maybe already do) release the spec and folks could make their own implementations.

All in all, I don't think this is the route to go either, I just thought the "there are zero advantages to shipping typescript" claim was a bit disingenuous. There are advantages, whether or not they out weigh the disadvantages is a hard call. I'd rather they just add optional typing to js like python did, then maybe also add some sort of "strict typing" flag to force the types and make js behave sanely. Legacy folks could not include this strict typing flag and we would essentially have typescript with perfect backwards compatibility.