Live data from Hacker News

TypeScript types can run DOOM [video]

youtube.com

21–30 of 391 posts

Re: TypeScript types can run DOOM [video]

#21
post #8

I got to watch Dimitri posting internal updates about his progress on this, and it has been utterly mindblowing. This is genuinely one of the most amazing things I've ever seen done with code. Absolutely legendary feat! (And also an incredible amount of persistence.)

Where can we see these updates?

Michigan Typescript has an active discord: https://discord.com/invite/DHtwNDTwrR

Re: TypeScript types can run DOOM [video]

#23

A WASM runtime in TypeScript types is impressive in its own right, but I think I can dimly see how it could work with a lot of effort. https://github.com/MichiganTypeScript/typescript-types-only-... What I don't understand is how this thing does keyboard input. At 3:42, the video simply says, "And, yes, there's a way to do keyboard input," without elaborating on how. What sorcery is that ? There must be something out…

I haven't checked the DOOM one, but for the Pong example, the keyboard input is prerecorded. As in the sequence of the keyboard key press are sequenced in a TS array[0].

[0]: https://github.com/MichiganTypeScript/typescript-types-only-...

Re: TypeScript types can run DOOM [video]

#24

A WASM runtime in TypeScript types is impressive in its own right, but I think I can dimly see how it could work with a lot of effort. https://github.com/MichiganTypeScript/typescript-types-only-... What I don't understand is how this thing does keyboard input. At 3:42, the video simply says, "And, yes, there's a way to do keyboard input," without elaborating on how. What sorcery is that ? There must be something out…

If I had to guess, it's a file with an array of keys pressed (or unpressed) at some time interval (say 0.1 seconds). Then a VS code extension can append to the array every 0.1 second along with any key-press states at that time. The compiler updates the game state whenever this array gets updated.

However, I'm guessing this is why we see a demo of pong and not doom. Doom probably just can't keep up with this.

No idea if I'm remotely on the right track here though.

Re: TypeScript types can run DOOM [video]

#25

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.

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.

Re: TypeScript types can run DOOM [video]

#28

imagine how amazing it would be if every major browser tomorrow suddenly dropped support for JS entirely and said that they only run typescript now. It will be a hard but absolutely mind blowing transition

What would be the point? Why waste time parsing and ignoring types? Types are for static analysis during comp time, they have nothing to do with the runtime and they don't provide "type hints" to the runtime about types, and code isn't optimized based on static typing analysis. Or should the browser do that? In that case which version of TypeScript? And by version I actually mean which tsconfig? Sorry for being picky but can't image why we would want something like that. If all we wanted was a compiled runtime like flash/actionscript was then I wonder why we killed flash

Re: TypeScript types can run DOOM [video]

#30

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.

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.
Post reply on HN