News for hackers. Stuff that matters.
Re:TypeScript Is Surprisingly OK for Compilers by xvilka on Friday August 18, 2023 @04:52AM (#37172944)
This is why once WebAssembly more polished and more common, languages like JS and TS could become obsolete since proper, more powerful languages will suddenly become a valid choice for Web.
Re:TypeScript Is Surprisingly OK for Compilers by flohofwoe on Friday August 18, 2023 @05:27AM (#37173198)
Any non-toy WASM application running in browsers will almost certainly end up as a hybrid WASM/JS application, just because you can't call directly from WASM into browser APIs, and even if the JS shim is "hidden from view", sometimes it's either more convenient or even more performant to write more than just a thin API shim in Javascript, especially for asynchronous code or to avoid redundant copying of large data blobs in and out of the WASM heap.
Re:TypeScript Is Surprisingly OK for Compilers by LudwigNagasena on Friday August 18, 2023 @06:06AM (#37173541)
> just because you can't call directly from WASM into browser APIs

Surely that will change someday.

Re:TypeScript Is Surprisingly OK for Compilers by flohofwoe on Friday August 18, 2023 @06:23AM (#37173673)
You are still limited by the fact that browser APIs are mainly designed for usage with Javascript, and those Javascript APIs usually don't map all that well to languages used with WASM (which typically use the "C ABI" for FFI). There is zero chance that each web API will get a second API which is compatible with "C calling conventions".

There is a (now inactive) "interface-types" proposal, which has dissolved into "component-types", but this scope-creep definitely is already quite concerning:

https://github.com/WebAssembly/interface-types

Re:TypeScript Is Surprisingly OK for Compilers by mbork_pl on Friday August 18, 2023 @05:23AM (#37173166)
You mean, like C and its derivatives became obsolete once successors to PDP machines were built? ;-)
Re:TypeScript Is Surprisingly OK for Compilers by andsoitis on Friday August 18, 2023 @08:52AM (#37174964)
> This is why once WebAssembly more polished and more common, languages like JS and TS could become obsolete since proper, more powerful languages will suddenly become a valid choice for Web.

JavaScript and TypeScript are not "proper" languages?

Different languages are powerful in different use case dimensions (tradeoffs), and the typical client-side web programming has a very very strong UI angle, which many "more powerful" languages that I am going to guess you have in mind are less adept at.

Re:TypeScript Is Surprisingly OK for Compilers by airstrike on Friday August 18, 2023 @09:32AM (#37175378)
JavaScript's redeeming quality is that it is ubiquitous due to being used by browsers. I don't think anybody credibly claims it to be a language we would want to use if we were to redesign web programming from scratch today
Re:TypeScript Is Surprisingly OK for Compilers by andsoitis on Friday August 18, 2023 @09:59AM (#37175698)
What follows is meant to be descriptive rather arguing "my camp is right".

> JavaScript's redeeming quality is that it is ubiquitous due to being used by browsers.

JavaScript has other properties that make it very adept at a wide range of web app usecases. Languages exist not in isolation, but have a dynamic environment w.r.t. domains they excel in, tooling, mindshare, programming in the small and the large, comlexity, etc.

> I don't think anybody credibly claims it to be a language we would want to use if we were to redesign web programming from scratch today

Dart has tried. Many languages transpile to JavaScript (and have for a long time).

Yet, JavaScript and TypeScript are some of the most popular languages on the planet.

If the web is still around in 20 years, it will be interesting to see whether another language has taken center stage. I'm not quite holding my breath, if only because even with transpilation being around for many many years, no other language has overtaken. I have a hard time seeing WASM changing that outcome in a meaningful way.

Re:TypeScript Is Surprisingly OK for Compilers by shepherdjerred on Friday August 18, 2023 @11:22AM (#37176862)
TypeScript is a pleasure to use. I have no desire to replace it with another language.
Re:TypeScript Is Surprisingly OK for Compilers by madeofpalk on Friday August 18, 2023 @11:50AM (#37177368)
Outside of the "everyone hates javascript" circle jerk, I really enjoy writing Typescript. I find its type system to be very natural and pleasent to use. It's my go-to for any generic task.
Re:TypeScript Is Surprisingly OK for Compilers by marcosdumay on Friday August 18, 2023 @12:35PM (#37178139)
> I don't think anybody credibly claims it to be a language we would want to use

Ouch, you posted this on the internet.

Somebody, somewhere is certainly going to claim this. Some of the people with that claim are even going to have a rationale behind it.

And to be fair, the tooling is going to push a lot of opinion. Because as bad as the JS/TS tooling is, its UI component has been evolving steadily while every other tool stagnated. And by now it has quite probably surpassed the 90's RAD paradigm (I mean, I can't make up my mind).

IMO, the language is one of the main things holding those tools back, but most people just won't agree.

Re:TypeScript Is Surprisingly OK for Compilers by thrashh on Friday August 18, 2023 @12:50PM (#37178422)
What language would that be?

I've programmed in Java, Python, C, C#, TypeScript, VHDL, and some other languages and they all fucking suck in some way.

If it was up to me, I would pick the best parts of the languages/ecosystems and make a Frankenstein language.

And anyway in the end, it's never the language. It's the ecosystem. Just because you can run Java on .NET doesn't mean you should -- because almost no one else does it your way and it's not worth the trouble maintaining some weird approach very few people use. You're never going to get help from library authors when it doesn't work on your weird setup.