Hacker News new | ask | show | jobs
by joshuakgoldberg 485 days ago
Nothing will ever top this for typescript types. This is the pinnacle. An entire virtual machine and system memory with garbage collector in types.

Turing Completeness is one level, but being able to run Doom is the real test of whether a programming environment is complete and robust. Absolutely stunning to see TypeScript's type system get there.

3 comments

Well we haven't implemented a web browser capable of running javascript in the typescript type system yet.

Quick, someone tell this author it's not possible.

Doom is Turing complete (https://calabi-yau.space/blog/doom.html), so it's just a matter of building the appropriate map.
(author here) _yes I realize how ridiculous what I'm about to say is considering the project I just shared_ but I actually strongly disagree, haahah. there's this thing I learned of called "the turing tarpit". my position is that just because something could theoretically be done with infinite time and infinite resources, doesn't mean you can even approach the throne of doing it for real in a human lifetime.

And if I'm just totally wrong on this, then you have your answer on why I never gave up on this project. I never once, ever, at any point, lost hope that it wouldn't work (HOW COULD IT?!).... right up until the very instant when I couldn't deny it anymore and it was on the screen in front of me.

Of course you're right, and I should have put quotes around "just". It would be amusing to calculate how long it would take to render the Google home page via Doom via TypeScript; I'd guess much longer than the age of the universe.
Off topic, but as an obsessive debugger and experimenter with ADHD and someone who hates telling people lies about what can and can't be done your motivation speaks to my soul. But my usual rabbit holes last just few hours up to few days. And even those that go far (that avoided all obstacles) end up right before implementing the last step, when it becomes obvious to me that this thing can be done. Congrats on the sheer stamina.

I might use lesson you provided in my future to actually achieve something. I just need to doubt the feasibility of even the last step.

> And if I'm just totally wrong on this, then you have your answer on why I never gave up on this project. I never once, ever, at any point, lost hope that it wouldn't work (HOW COULD IT?!).... right up until the very instant when I couldn't deny it anymore and it was on the screen in front of me.

Has this experience changed your way of thinking at all? It sounds like the thing people thought was possible actually was possible, and that Turing completeness really did mean what people thought it did.

I hope this doesn't come off wrong like but honestly - but the outcome on this project doesn't change my view one bit. it didn't make me dig in my heels either, but I strongly doubt it's possible in a human lifetime to do this with at least some of the other languages that have type systems that are considered Turing complete.
That's not really relevant. Turing complete languages are used to build Doom and Pong, but one is more impressive than the other.
Pong was (originally) built using transistor-transistor logic on a circuit board. AFAIK it did not involve any software at all.
It looks like they built a WASM runtime in the TS type system. Implement some more OS calls and you should be able to get a browser running. And then WASM on WASM on TS types. Lol
I for one would like to see TypeScript's type inference be self-hosted
Not unless someone ports typescript to typescript types. That would be some next-level self-hosting haha
The first compiler that can play it on real time will be deemed the pinnacle for TS compilers.