News for hackers. Stuff that matters.
Re:Toward a TypeScript for C++" by ktbwrestler on Saturday November 04, 2023 @10:03AM (#38141076)
I’m not a frontend guy but heard that typescript is already falling off and contentious at this point. Is it truly something that’s going to stay?
Re:Toward a TypeScript for C++" by jmull on Saturday November 04, 2023 @10:26AM (#38141284)
You heard wrong.

The only way typescript is going away is if JS essentially incorporates it.

The only things people don't like about it is that you need some tooling and a build step.

However, with its popularity, ts is built in to a lot of things, so the tooling usually isn't a big burden (particularly to get started).

And it's viable in a lot of cases these days to forgo the build step and instead use JS with typescript type annotations. (That might be what you heard about. That's really still using typescript, though.)

Re:Toward a TypeScript for C++" by leptons on Saturday November 04, 2023 @12:45PM (#38142695)
>The only things people don't like about it is that you need some tooling and a build step.

Wrong. Many people dislike many things about Typescript.

https://levelup.gitconnected.com/the-inevitable-decline-of-t...

https://medium.com/codex/why-are-javascript-pros-saying-good...

https://gomakethings.com/ditching-typescript-for-javascript/

https://www.reddit.com/r/sveltejs/comments/12cyady/are_you_l...

There are plenty more examples of why people tried typescript and went back to javascript. It's definitely not only because of a build step, but also "type gymnastics", and other code bloat.

Re:Toward a TypeScript for C++" by csjh on Saturday November 04, 2023 @02:31PM (#38143823)
Claiming "many people" and proceeding to link to 4 posts that use Svelte as an example is a bit silly considering Rich Harris has said, numerous times, that the decision in Svelte's codebase should NOT be taken as advice for what to do in your codebase, because their decision only pertains to a very specific set of circumstances.
Re:Toward a TypeScript for C++" by leptons on Saturday November 04, 2023 @05:32PM (#38145353)
I was countering the previous comments assertion that "the only reason" people don't like typescript was because it has a build step, and your comment doesn't prove me wrong.
Re:Toward a TypeScript for C++" by zukzuk on Saturday November 04, 2023 @10:10AM (#38141146)
Typescript has a lot of momentum on all fronts and is almost certainly the future of Javascript.

The big problem is that it still requires transpilation, which can set up all sorts of shitty traps. Not to mention that the Javascript ecosystem in general is a horrendous mess, which Typescript on its own can’t fix.

Re:Toward a TypeScript for C++" by mgaunard on Saturday November 04, 2023 @10:22AM (#38141239)
The future of JavaScript is in the past. Get rid of all the stupid transpilers and frameworks and just use plain JavaScript in the browser.
Re:Toward a TypeScript for C++" by fryktelig on Saturday November 04, 2023 @10:24AM (#38141259)
Yeah once they implement the proposal to add types we will
Re:Toward a TypeScript for C++" by mgaunard on Saturday November 04, 2023 @10:42AM (#38141429)
The whole point of JavaScript is that it's dynamically-typed. If you want static typing just use C++ or any other established programming language.
Re:Toward a TypeScript for C++" by marcosdumay on Saturday November 04, 2023 @10:52AM (#38141550)
> it's dynamically-typed

Yet, most of the code people write has statically defined types.

Anyway, the whole point of JavaScript is that it runs on the browser. Outside of that, it has no strong points. Even though most of them are not weak enough to immediately abandon the language, its type system is one of the weakest.

Re:Toward a TypeScript for C++" by leptons on Saturday November 04, 2023 @12:48PM (#38142729)
Javascript's dynamic typing is fine if you aren't a really shitty programmer.
Re:Toward a TypeScript for C++" by bigfudge on Saturday November 04, 2023 @10:52AM (#38141540)
I’m not sure how people are supposed to do that in the browser. This feels like an excessively dismissive comment.
Re:Toward a TypeScript for C++" by mgaunard on Saturday November 04, 2023 @12:07PM (#38142322)
Have you not heard of WebAssembly?
Re:Toward a TypeScript for C++" by kangalioo on Sunday November 05, 2023 @04:17AM (#38149534)
WebAssembly is not without tradeoffs either. I'm not an expert, but it's often heavier due to bundling the native language's stdlib; it's annoying to interop with the browser environment because that's still JavaScript-tailored; it's also just hard to write code that can be compiled into WASM (e.g. in Rust, it needs to be `#[no_std]`)
Re:Toward a TypeScript for C++" by mgaunard on Sunday November 05, 2023 @08:38AM (#38151014)
If you're doing real work, you don't interact with the browser.

If you're just glueing things together between APIs, then JavaScript is fine, and static typing would just get in the way.

Re:Toward a TypeScript for C++" by ravenstine on Monday November 06, 2023 @09:35AM (#38163138)
With possibly the exception of Typescript, I agree. Practically all the tools commonly being thrown at JavaScript today are destroying the developer experience and causing more problems that begat even more tools. It's easier than ever to use plain JavaScript in ways that use proper scoping, but so many developers today speak as if this is impossible ("it just doesn't scale bruh"). That's how you know you're talking to someone who didn't write software before ~2011. It's fine if someone prefers to use said tools, but the idea that more tools are are necessary is an example of poor engineering.
Re:Toward a TypeScript for C++" by herpdyderp on Saturday November 04, 2023 @10:24AM (#38141263)
There a very limited number of high profile, very niche projects that have switched to types via comments to skip transpile time. (IIRC, a super low level part of the Deno engine.) This does not represent the industry moving away from TypeScript.
Re:Toward a TypeScript for C++" by afavour on Saturday November 04, 2023 @10:21AM (#38141234)
IMO the only way TyoeScript is going away is if all the useful components end up getting merged into JS. It’s simply too useful.
Re:Toward a TypeScript for C++" by pferdone on Saturday November 04, 2023 @10:06AM (#38141112)
Where have you heard that? Because Typescript is the defacto standard right now. Projects like bun and deno cement that status further.
Re:Toward a TypeScript for C++" by davedx on Saturday November 04, 2023 @10:22AM (#38141245)
A couple of relatively high profile projects stopped using it. Meanwhile across most industries companies use it, I almost never encounter vanilla JS projects these days
Re:Toward a TypeScript for C++" by solumunus on Saturday November 04, 2023 @10:31AM (#38141322)
Typescript is only becoming more solidified each year.
Re:Toward a TypeScript for C++" by zdhgbdthdtv on Saturday November 04, 2023 @10:28AM (#38141298)
> heard that typescript is already falling

Don't believe in everything you hear.