News for hackers. Stuff that matters.
Re:Rust Port of TypeScript (Tsc) by zdragnar on Wednesday October 07, 2026 @09:30PM (#50000957)
Why do you think Golang is no longer a reasonable choice?
Re:Rust Port of TypeScript (Tsc) by vaughands on Wednesday October 07, 2026 @09:38PM (#50001010)
I suppose my comment sort of implies this. I think the naive knee jerk reaction is that if you can spit out perfect machine level code against a specification, then logically being closer to bare metal would help with performance. However, without knowing the details of how things worked it is tough to say whether it is truly "reasonable" or not.

But more importantly, the Typescript team themselves [1] picked Golang mostly out of ergonomics and ease of porting at the time. It is becoming more increasingly more to "taste" what ergonomics means. Notably, they did not pick it because they believed it to be the fastest option. But speed was on the mind, giving way to ergonomics and ease of porting. At least, this is my read.

[1] https://github.com/microsoft/typescript-go/discussions/411

Re:Rust Port of TypeScript (Tsc) by dunham on Wednesday October 07, 2026 @09:52PM (#50001097)
The author of esbuild used Rust and later switched to Go. He describes some of his experience here:

https://news.ycombinator.com/item?id=22336284

It is one person and one project, but I found it interesting to read about his experience.

I like Go, but I probably would have tried Rust first because I want pattern matching when implementing languages.

Re:Rust Port of TypeScript (Tsc) by e12e on Thursday October 08, 2026 @06:33AM (#50004114)
Very interesting. With rust's ocaml heritage, I'd imagine a straight port from typescript would be simpler and more idiomatic than a port to go. I guess not.
Re:Rust Port of TypeScript (Tsc) by jitl on Thursday October 08, 2026 @09:01AM (#50005326)
Rust memory management is very different from GC heap memory management.
Re:Rust Port of TypeScript (Tsc) by pjmlp on Thursday October 08, 2026 @10:01AM (#50005917)
While true, it has not prevented other Microsoft teams to port Typescript, and .NET code into Rust.

Notorious examples, the recent Github Copilot runtime, and the Microsoft 365 microservices.

Re:Rust Port of TypeScript (Tsc) by e12e on Thursday October 08, 2026 @02:23PM (#50009822)
Are you saying typescript idioms are significantly different from rust idioms (for a parser/grammar implementation) due to memory management?

The "shape" of the code would be different?

Re:Rust Port of TypeScript (Tsc) by jitl on Thursday October 08, 2026 @02:49PM (#50010246)
they wanted to do a direct line by line port. they evaluated rust and picked go because the gc let them keep code structure.
Re:Rust Port of TypeScript (Tsc) by vrighter on Sunday October 11, 2026 @07:07AM (#50041901)
pretty much most nontrivial programs need to have a different shape to fit into the rust mindset.

For example i wrote a digital logic simulator. The last step involved a linking step to turn all indexes into pointers, once the component graph is generated in full and becomes stable in memory. The simulator just chased pointers.

In rust all of that would have either had to keep using indices, be highly non idiomatic by boxing everything (and slower), or implemented in unsafe rust.

If I have to write a lot of unsafe rust, then i would actually switch to cpp because unsafe c++ is easier to get right than unsafe rust

Re:Rust Port of TypeScript (Tsc) by andrewingram on Thursday October 08, 2026 @05:55AM (#50003854)
The notable thing that these LLM-generated ports aren't doing is _rewriting in Go_. TypeScript 7 is a lot faster than the JS/TS-based version 6, but memory use is a major bottleneck.

However, it mostly represents a mechanical port of the old codebase to Go. What I haven't seen anyone do is try a true rewrite in Go optimized for performance (whilst keeping a strong emphasis on readability).

Re:Rust Port of TypeScript (Tsc) by flohofwoe on Thursday October 08, 2026 @10:27AM (#50006244)
> then logically being closer to bare metal would help with performance

Once you move beyond interpreters, performance is mostly a property of how much effort you want to put into profiling and optimization, not any specific properties of a programming language (YMMV of course).

Re:Rust Port of TypeScript (Tsc) by spoiler on Thursday October 08, 2026 @11:06AM (#50006731)
I agree, but certainly language constraints or features make analysis easier (and some analysis which was previously impossible now suddenly is) which in turn unlocks/enables a whole world of optimisations the compiler can do for you!
Re:Rust Port of TypeScript (Tsc) by lr1970 on Thursday October 08, 2026 @05:23PM (#50012513)
> you can spit out perfect machine level code against a specification

Typescript team explicitly mentioned the lack of Typescript specification as one of the reasons to choose Go. Typescript as the language is defined currently by its compiler which was Javascript based. Go port is as close to it as possible while Rust would be harder to reach fully identical behavior.

Re:Rust Port of TypeScript (Tsc) by lifthrasiir on Wednesday October 07, 2026 @09:34PM (#50000990)
Presumably because Rust is more suitable than Go in agentic coding? (I'm not sure, but that seems the purported answer.)
Re:Rust Port of TypeScript (Tsc) by lifeisloving on Wednesday October 07, 2026 @10:00PM (#50001148)
Language and compiler design/ implementation is very much a human task. There's lots of nuances to consider. I doubt they want agent spaghetti code in their codebase either.
Re:Rust Port of TypeScript (Tsc) by true_religion on Thursday October 08, 2026 @08:21AM (#50004944)
I don't know. Many people implementing DSLs were happy to live with whatever lexx and yacc spat out for years.
Re:Rust Port of TypeScript (Tsc) by sreekanth850 on Wednesday October 07, 2026 @10:28PM (#50001292)
Rust is more close to metal. No GC
Re:Rust Port of TypeScript (Tsc) by pebal on Thursday October 08, 2026 @01:06AM (#50001972)
There is no connection. Rust has ARC which performs worse than the tracing GC.
Re:Rust Port of TypeScript (Tsc) by saagarjha on Thursday October 08, 2026 @03:57AM (#50003037)
Than Go's GC? I think that is fairly unlikely in most cases.
Re:Rust Port of TypeScript (Tsc) by pebal on Thursday October 08, 2026 @04:19AM (#50003178)
It depends on the workload. ARC can be more expensive than tracing GC, especially with heavily shared objects.

But my main point was that the presence of a GC has nothing to do with how close a language is to the metal. Memory management strategy and low-level capabilities are two separate things.

Re:Rust Port of TypeScript (Tsc) by sreekanth850 on Thursday October 08, 2026 @05:33AM (#50003704)
I gave two separate reasons. Rust provides explicit control over memory allocation and management, and it has no garbage collector.
Re:Rust Port of TypeScript (Tsc) by pebal on Thursday October 08, 2026 @06:52AM (#50004264)
Rust could just as well have an optional tracing GC for shared ownership instead of ARC, potentially improving performance rather than reducing it. Having a GC doesn't inherently make a language slower.
Re:Rust Port of TypeScript (Tsc) by josephg on Thursday October 08, 2026 @08:10AM (#50004859)
> a GC doesn't inherently make a language slower.

Yeah but let's be honest; GC languages (Go, Java, C#) usually are slower than systems languages. Systems languages just give you more, low level control over the computer from within your program. You can use that control to improve performance. Eg, you can control data locality, memory access patterns, the emitted assembler, and way more stuff.

Of course you're right - if you misuse arc, you can make your program slow. So don't misuse arc then. Rust gives you lots of options for structuring memory. If you choose badly, that's on you.

Re:Rust Port of TypeScript (Tsc) by legulere on Thursday October 08, 2026 @10:11AM (#50006032)
Not everything has to be ARC though and arenas are strictly better than GCs lacking synchronization issues for allocation and not needing any scanning for deallocation.
Re:Rust Port of TypeScript (Tsc) by aka-rider on Thursday October 08, 2026 @04:15AM (#50003147)
GC doesn’t affect performance (at least visibly), memory allocations on critical paths do. Moreover, Rust ARC may cause memory fragmentation and perform worse than a GC.

Writing Rust, Zig, or Go, you would still control memory manually, where it matters.

Re:Rust Port of TypeScript (Tsc) by dwattttt on Thursday October 08, 2026 @04:47AM (#50003384)
It does have an impact. Discord blogged about unavoidable GC delays in go that occurred because go needed to traverse live memory, their only option (in go) for reducing that pause was to reduce the size of their data set.
Re:Rust Port of TypeScript (Tsc) by legulere on Thursday October 08, 2026 @09:15AM (#50005462)
That seems like a latency rather than a throughput issue. In compilers I would expect latency to be a lesser problem.
Re:Rust Port of TypeScript (Tsc) by sreekanth850 on Thursday October 08, 2026 @05:19AM (#50003606)
https://discord.com/blog/why-discord-is-switching-from-go-to...

GC absolutely has performance costs, even with minimal allocations, because tracing collectors must scan live objects. This is exactly what this post says. Don't know if its really improved over time in real world cases.

Re:Rust Port of TypeScript (Tsc) by aka-rider on Thursday October 08, 2026 @08:13PM (#50014255)
Makes sense.
Re:Rust Port of TypeScript (Tsc) by spankalee on Wednesday October 07, 2026 @09:37PM (#50001008)
Rust is better at targeting WebAssembly
Re:Rust Port of TypeScript (Tsc) by cowsandmilk on Wednesday October 07, 2026 @10:08PM (#50001190)
why would that be important? Having a typescript compiler in wasm seems like a pretty niche need.
Re:Rust Port of TypeScript (Tsc) by viraptor on Thursday October 08, 2026 @01:14AM (#50002010)
Theo is making a new twist on the idea of IDE which hosts the application itself. I'm sure there's going to be a video about it soon. But the idea is to embed the whole compilation and type-check in wasm in the browser which then runs the app immediately, as the agents edit the code.
Re:Rust Port of TypeScript (Tsc) by pjmlp on Thursday October 08, 2026 @04:33AM (#50003269)
Because you need to keep the compiler running here,

- https://www.typescriptlang.org

- https://code.visualstudio.com/docs/remote/vscode-web

Re:Rust Port of TypeScript (Tsc) by Benjamin_Dobell on Thursday October 08, 2026 @06:10AM (#50003961)
It's extremely useful if your distribution platform is the web. However, I find it much more valuable as a type checker than a compiler. I use TypeScript extensively (in several projects) for defining schemas types.

For example, in the Breaka Club (https://breaka.club/) editor, which is not presently exposed to kids yet, we define behaviors for characters, props, mosaics (terrain tiles) and items in JSON. But the JSON has type checking and real-time completion as you type. Not naive property auto-suggestion, we have effect types and they're context aware in that you can refer to targets introduced higher in parent constructs of the JSON — and they're fully type checked. If you refer to a target that does not exist in a context, it won't validate and you cannot save the schema.

We use tsgo for development, but the editor (runtime schema validation) is presently stuck on TypeScript 6 because there's no WASM support.

Now, is it nutty that we're using TypeScript for JSON validation? A little. But it's extremely powerful. We're going far beyond what's capable with Zod or ArkType.

Re:Rust Port of TypeScript (Tsc) by tcfhgj on Thursday October 08, 2026 @07:02AM (#50004328)
But it's not the only niche, see Typst compiler in wasm for live document generation in the browser.
Re:Rust Port of TypeScript (Tsc) by teki_one on Wednesday October 07, 2026 @09:45PM (#50001060)
Why?
Re:Rust Port of TypeScript (Tsc) by spankalee on Wednesday October 07, 2026 @10:06PM (#50001180)
Wasm is a first-class target for Rust, which produces faster and smaller Wasm binaries. My understanding is that you need to use TinyGo to reasonably target Wasm with Go.

Go having a garbage collector isn't necessarily bad, since Wasm has GC, but I think Go's GC can't easily use Wasm GC because Go has interior pointers.

Re:Rust Port of TypeScript (Tsc) by win311fwg on Thursday October 08, 2026 @03:29AM (#50002830)
WASM is also a first-class target for Go (gc).

However, it has a relatively large runtime, so TinyGo is often preferred when bundle size needs to be small.

Re:Rust Port of TypeScript (Tsc) by 0x696C6961 on Wednesday October 07, 2026 @09:52PM (#50001098)
I think the main advantage is size. Rust doesn't need to include the runtime.
Re:Rust Port of TypeScript (Tsc) by cmrdporcupine on Wednesday October 07, 2026 @09:54PM (#50001111)
I'm assuming they mean because it doesn't need a garbage collector or much of a runtime at all. You can target direct to WASM and use I guess WASI, while Go brings with it a garbage collector and so on.
Re:Rust Port of TypeScript (Tsc) by pebal on Thursday October 08, 2026 @03:51AM (#50002986)
WASM makes no sense and has no future.
Re:Rust Port of TypeScript (Tsc) by pjmlp on Thursday October 08, 2026 @04:33AM (#50003266)
Re:Rust Port of TypeScript (Tsc) by pebal on Thursday October 08, 2026 @04:43AM (#50003347)
I’m not saying it doesn't work. I’m saying it’s a waste of resources and won’t gain widespread popularity. The current trend is porting source code to languages that generate native code.
Re:Rust Port of TypeScript (Tsc) by josephg on Thursday October 08, 2026 @07:53AM (#50004738)
> I’m saying it’s a waste of resources

A waste of what resources? Other people's time? That isn't up to you to decide. I think your comment is a waste of resources. But how you spend your time isn't up to me. And how wasm people spend their time isn't up to you.

> The current trend is porting source code to languages that generate native code.

Cool story, but without wasm, how are you gonna run that native code in a browser?

Re:Rust Port of TypeScript (Tsc) by pjmlp on Thursday October 08, 2026 @04:58AM (#50003462)
I dislike the WebAssembly advocacy of some folks, where they act as if there weren't similar attempts all the way back to UNCOL in 1958, and even in recent history, seem to only focus on JVM, while ignoring the CLR and BEAM.

However, there are indeed some cases where it does make sense since we have it around anyway, and one of them is running the Typescript compiler in the browser, now that it is written in a compiled language.

Re:Rust Port of TypeScript (Tsc) by dwattttt on Thursday October 08, 2026 @04:44AM (#50003367)
Languages that target WebAssembly _are_ languages that generate native code? C & Rust for example.
Re:Rust Port of TypeScript (Tsc) by conartist6 on Wednesday October 07, 2026 @10:01PM (#50001154)
Was it ever a reasonable choice? At the time the choice was made the tooling ecosystem was already split between Rust and JS, and by putting TS in Go they chose to split it three ways. Why not split it 4 or 5 ways then? The pressure will always be towards less duplicated work.

The only real choice of language to build the next generation of JS tools in is JS. Anything else is a vote of no confidence in ourselves.

Re:Rust Port of TypeScript (Tsc) by dwattttt on Thursday October 08, 2026 @04:55AM (#50003440)
It's ok for a language (JS in this instance) to be good in a domain but not good in all domains. Pulling a language in every direction forces it to make compromises that hurt its applicability in specific areas.
Re:Rust Port of TypeScript (Tsc) by conartist6 on Thursday October 08, 2026 @07:39AM (#50004617)
You seem sure like them that JS is not good. They didn't even bother to consider it as a choice!

If you wanted to point to their evidence you couldn't because they don't have any.

Re:Rust Port of TypeScript (Tsc) by dwattttt on Thursday October 08, 2026 @08:16AM (#50004897)
I'm suggesting that JS is not good for every possible use. And that is ok.

I would not want a core internet router or a kernel to be implemented in JS. But I am happy it is used elsewhere.

Re:Rust Port of TypeScript (Tsc) by conartist6 on Thursday October 08, 2026 @08:42AM (#50005154)
So for context my beef with them is that they didn't try. I think you're being very "hand wavey" about why JS isn't a good host language, just as they were.

If the argument is that it's not fast enough, JS is actually quite fast: https://mrale.ph/blog/2018-02-03-maybe-you-dont-need-rust-to...

If the argument is "we need to show a 10x boost in raw throughput" then I think we first need to have an argument about why throughput is the right metric as a target for optimization. Throughput is the critical performance measure of a batch processing architecture. IDE's, like web UIs, "feel fast" when they're responsive, which is to say when they can start giving the user access to useful output (and interaction) at the soonest moment the program could possibly be ready to do so. In web perf we might measure this as INP: time from Interaction to Next Paint.

JS won't be winning prizes for throughput, no, but if we completed the move away from a batch processing mindset to an incremental recomputation mindset, and at the same time switched to measuring responsiveness metrics like INP, suddenly the perf characteristics of JS seem a lot more helpful. It's the closest language to the DOM, so when your IDE's interface is built on web technology you'll optimize INP by keeping the data layer in JS: https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r...

There's an even stronger reason than the DOM though to see JS as the "native" layer for perf: plugins. An IDE's selling point is integration, and users want to extend their IDEs by writing Javascript code. Like it or not, JS is the most natural and highly-performant native kernel language for a system of JS plugins.

Re:Rust Port of TypeScript (Tsc) by dwattttt on Thursday October 08, 2026 @10:04AM (#50005948)
You may have missed the project history, this _was_ implemented in JS previously. I don't think they were interested in porting it back to a language it was originally written in.
Re:Rust Port of TypeScript (Tsc) by conartist6 on Thursday October 08, 2026 @10:27AM (#50006243)
I know my history just fine. What I'm saying is: you can't say that it means that JS is a bad language to write tools in. That's would be like saying "our design had bad perf and it was implemented as JS, therefore no design implemented in JS can have good perf". I hope we agree this would be a faulty deduction, or at least an unfounded one.
Re:Rust Port of TypeScript (Tsc) by Rapzid on Thursday October 08, 2026 @08:29AM (#50005028)
It was already in "JS". It was ported to Go.
Re:Rust Port of TypeScript (Tsc) by mordv on Thursday October 08, 2026 @10:25AM (#50006221)
The case against JS was specific: data marshalling neglects the Web Workers performance boost for an "embarrassingly parallelizable" project. And it was stated clearly.