16 ms·
TypeScript types can run DOOM [video]
- sim04ful 2y agoI know the following comment is discouraged from hackernews but these are extenuating circumstances: Yoooo WTAF
- goodoldneon 2y agoTo be clear, it's running in TypeScript types only -- not JavaScript. Absolutely insane
- deleted 2y ago[deleted]
- joshuakgoldberg 2y agoNothing 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.
- pcthrowaway 2y agoWell 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.
- orangecat 2y agoDoom is Turing complete (https://calabi-yau.space/blog/doom.html https://calabi-yau.space/blog/doom.html), so it's just a matter of building the appropriate map.
- pcthrowaway 2y agoThat's not really relevant. Turing complete languages are used to build Doom and Pong, but one is more impressive than the other.
- Jolter 2y agoPong was (originally) built using transistor-transistor logic on a circuit board. AFAIK it did not involve any software at all.
- dimitropoulos 2y ago(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.
- orangecat 2y agoOf 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.
- scotty79 2y agoOff 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.
- acchow 2y agoIt 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
- brundolf 2y agoI for one would like to see TypeScript's type inference be self-hosted
- phpnode 2y agoYou're in luck! https://github.com/ronami/HypeScript https://github.com/ronami/HypeScript
- aylmao 2y agoNot unless someone ports typescript to typescript types. That would be some next-level self-hosting haha
- mattigames 2y agoThe first compiler that can play it on real time will be deemed the pinnacle for TS compilers.
- Rzor 2y agoIf there's one top story HN deserves today, it has to be this. Absolutely insane and incredibly inspirational.
- karmakaze 2y agoMy literal LOL of the month. Love the types scale graphics/animation. :mind-blown:
- sangeeth96 2y agoBlew my mind! Dimitri talks about it in the video but I love the mention of how this project came to be[0]: > This engine was built to service a project that aimed to demonstrate why Doom can't run in TypeScript types. Well. The funny thing is.. It can. [0]: https://github.com/MichiganTypeScript/typescript-types-only-wasm-runtime https://github.com/MichiganTypeScript/typescript-types-only-...
- sn9 2y agoWhat was the argument for why it couldn't?
- mbb70 2y agoBecause we lack an infinite tape and infinite time, not everything that is Turing complete can run DOOM
- n2d4 2y agoOr more specifically, everything that is Turing complete can run DOOM, but most languages are only Turing complete under certain assumptions which are not met in practice
- akie 2y ago> not everything that is Turing complete can run DOOM Beware with such blanket statements, you might inspire someone to do 18-hour days for a year to prove you wrong.
- zelphirkalt 2y agoNot having infinite tape is true for all computers though. And probably also not infinite time as well.
- LoganDark 2y agoHe tried and tried and tried to find one and accidentally proved instead that it could.
- acemarke 2y agoI 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.)
- pcthrowaway 2y agoWhere can we see these updates?
- sys13 2y agoMichigan Typescript has an active discord: https://discord.com/invite/DHtwNDTwrR https://discord.com/invite/DHtwNDTwrR
- dimitropoulos 2y agothe #doom channel is where Mark is referring to. it's all there!
- kamilafsar 2y agoThat's pretty insane Dimitri. If you like stuff like this I really recommend Dimitri's TypeScript challenges series: https://www.youtube.com/playlist?list=PLOlZuxYbPik180vcJfsAM6xHYLVxrEgHC https://www.youtube.com/playlist?list=PLOlZuxYbPik180vcJfsAM...
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- ramesh31 2y agoBrilliant. The TS type system is a true marvel of modern software engineering. Its a shame that it hasn't just been developed into a proper fully fledged runtime at this point. Something like Deno is the closest we'll get it seems.
- mseepgood 2y agoIt is not a mark of quality, quite the opposite.
- dimitropoulos 2y agohi! author here! selfishly, it'd be really useful to me if you could take a moment to elaborate on your thinking here. it's not an altogether-too-too-uncommon viewpoint and I'd like to understand it if you have a chance.
- Kuraj 2y agoWhat the FUCK
- user2093 2y agoAbout time some good news!
- dang 2y agoRelated: MichiganTypeScript: A WebAssembly runtime implemented in TypeScript types - https://github.com/MichiganTypeScript/typescript-types-only-wasm-runtime https://github.com/MichiganTypeScript/typescript-types-only-... (via https://news.ycombinator.com/item?id=43185174 https://news.ycombinator.com/item?id=43185174, but we merged that thread hither)
- bilekas 2y agoThis shouldn’t be possible.. Typescript devs have lost their collective minds and I’m totally here for it. Edit : TS not front end
- dimitropoulos 2y agoI didn't ask them outright, but I sorta think the TypeScript team might agree with you on this point! haha. At least we can all agree it's not an intended use-case, to play Doom.
- winwang 2y agoCounterpoint, it absolutely should be (barring the pedanticness of modding it a bit): https://news.ycombinator.com/item?id=37555651 https://news.ycombinator.com/item?id=37555651
- alex_suzuki 2y agoTry to fit that in a context window! Absolutely amazing.
- dimitropoulos 2y ago(author here) that was one of the 1st-week "ok, but THAT'S surely a good reason this can't work..." until I dug in and (to my great surprise) found a way.
- dfabulich 2y agoA 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-wasm-runtime 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 outside the type system translating keyboard input into TypeScript types…??
- darcien 2y agoI 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-wasm-runtime/blob/afb418c24fa3980ec4cd4e4b04382fc7759ed348/packages/playground/pong/pong.engine.ts#L30-L47 https://github.com/MichiganTypeScript/typescript-types-only-...
- dimitropoulos 2y agoyep! exactly this! like how a tool assisted speedrunner works
- Jare 2y agoThat's also how the Doom demos worked right? :D
- pcthrowaway 2y agoIf 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.
- nicetryguy 2y agoIncredibly good video editing, unbridled insantiy, cheers!
- dimitropoulos 2y agoconservatively 200 hours dropped into that 7 minute video - so you can imagine how happy I am to hear people are enjoying it!
- sys13 2y agoNot only is Dimitri an amazing engineer - he's also great at building community and event/video production. Michigan Typescript meetups and videos have a level of polish that goes over and above
- jschoe 2y agoIn the YouTube comments he stated nonetheless that he still bombed big tech interviews, specifically the technical portion, probably because of some ridiculous LeetCode problem he did not memorize beforehand. It just goes to show how these procedures do not effectively determine who is actually a good engineer or programmer. If this guy can't land a job while achieving this, then something is not quite right with the interview process.
- dimitropoulos 2y agohi! yep! this definitely happened. I do mention it in the next "why" video, but it's good feedback to know this is interesting to people because I could say a bit more about what those rejections were like - specifically the one where I failed the technical screening. I'm actually really excited to share that part of the story because I hope it can be a small thing in the back of people's mind to help them if it happens to them. It can happen to anyone. Interviews are SUCH a lossy process and most engineers I know don't have any training on how to do interviews at all - yet we just assume they know how to evaluate people's skillsets.
- hakaneskici 2y agoWhat you've accomplished demonstrates a very important skill you have, persistence. Kudos and don't give up. About those rejections, did they effect your confidence in yourself and your skills? How did they make you feel?
- dimitropoulos 2y agoI was crushed and embarrassed. Yep. Not even gonna lie. I used to work on Insomnia at Kong, which is literally a frontend for cURL. But some of the questions I couldn't answer were like "how do you get headers with cURL". I DON'T FRIGGIN KNOW. THAT'S WHY I WORKED ON A GUI FOR CURL. I CAN'T STAND USING THE CLI. lol. But to them, it was a question they were supposed to ask, and I got it wrong. Same story for questions about the git CLI DX (I'm a GitKraken fanatic lol), and more like that. I would rate my confidence overall as being quite low. Well. I donno how to explain what I'm trying to say. It's not that it's low or high, it's that I don't factor it in a lot in what I decide to do. Where I've noticed some people dip their toe in, I find it easy to just cannon-ball into the frozen lake without needing a lot of justification. That's what I meant in the video about "close-enough-manship". I'm a sort of personality that spends a lot of time just failing miserably over and over again in the least efficient way possible until I get what I'm looking for - and I usually quickly move on before I learn what I could have done better, lol. I've been told that my comfort in the face of non-stop-failures is what confidence is, but I donno if that sounds right. Getting a job these days is really tough on the psyche.
- vivzkestrel 2y agoimagine 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
- deleted 2y ago[deleted]
- hollowturtle 2y agoWhat 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
- vivzkestrel 2y agoit would get rid of babel immediately and the billions of hours of transpile time spent across the planet by people converting ts into js. You ll be able to run ts natively without transpilation across every major browser
- dimitropoulos 2y agoI think that would be a big loss for TypeScript and a very unfortunate thing for the whole ecosystem.
- aylmao 2y agoAt this point the easiest way to know if a system is Turing complete is to check if someone has ported DOOM to it haha Very impressive!
- cobbal 2y agoOnly if the church-turing-carmack thesis holds, which I personally doubt
- FergusArgyll 2y agoHN Pedantism never fails to elicit a chuckle from me
- ccvannorman 2y agoAlternatively if The Romero Hypothesis is proven to map the distribution of Mancubus numbers ... >_<
- kridsdale1 2y agoIf it holds does that confirm that I’m his bitch?
- khazhoux 2y agoMost people would agree that Mengelberg‘s 1984 paper clearly answers that question … of course, we all know that his language is famously hard to parse!
- evolveyourmind 2y agohttps://github.com/desi-ivanov/ts-lambda-calc https://github.com/desi-ivanov/ts-lambda-calc
- vardump 2y agoDoom compiled to just 177 TB (terabytes) of TypeScript types. Amazing on many levels.
- luckystarr 2y agoThis must be the quintessential example of a Turing tarpit. In TypeScript types, everything is possible, but nothing of interest is easy.
- tgv 2y agoFor the first frame...
- abound 2y agoI think that 177 TB is for the whole shebang, it's just that it took 12 days to render the first frame.
- dimitropoulos 2y agoboth this and parent comment are right! once you have the first frame, it's probably just a few hundred more megabytes to get the second one - although I won't be the one to find out! 1 is enough for for me!
- hoppp 2y agoAmazingly inefficient. But I would not be able to reproduce this feat so hats off.
- saagarjha 2y agoI mean it’s a very efficient implementation of the inefficiency.
- nokeya 2y agoBad Apple time!
- saagarjha 2y agoBad Apple would probably be trivial considering the work he did.
- koakuma-chan 2y agoI wish tsc didn't take eternity to run though.
- mithametacs 2y agonow we have a benchmark
- R3Y-P2U-jz3PVKd 2y agoI hope he learned something useful while doing it and it seems like he did, because, although regarding all the comments here I'll likely be alone in my assessment, I just see a massive waste of time & effort? He described it as "a brutal year-long journey of 18 hour days" and he didn't bootstrap a company, he wrote Doom in Typescript types...?! The "epic" doom music underlying his story just makes it seem even more comical to me. Maybe it's just me, don't want to crash the party. Carry on
- deleted 2y ago[deleted]
- antihero 2y agoI guess you have to ask yourself, what truely gives value in life? The answer is that value is subjective, and this person is wasting his time no less or more than you or I.
- Gehinnn 2y agoYou could say the same about art. Artists put lots of time and effort into creating unuseful things to inspire others. Just like here!
- abound 2y ago> don't want to crash the party > I just see a massive waste of time & effort Kinda seems like you do wanna "crash the party". I disagree that this is a "waste of time" of course, the value I see here is manyfold: 1. Learning how to do self-directed learning, managing time, etc 2. Learning, at an expert level, about dozens of complicated (not to mention in-demand) CS subdomains 3. Doing something that nobody has attempted, and few people could realistically accomplish 4. Having fun on the journey of taking a ridiculous idea from conception through to a truly functional implementation 5. Sharing something you've built with the world It is, of course, not everyone's cup of tea, but if someone wants to spend a not insignificant fraction of their life building something unique (and beautiful, in its own way) and sharing it with the world, to the detriment of quite literally nobody else, I support them in their adventure.
- porridgeraisin 2y ago
- ulrischa 2y agoTypescript is for me one of the most overengineered programming languages. Why did JS not follow the way python and php did? Integrate types in the main language but make it optional.
- BoorishBears 2y agoThank god they didn't follow the way Python did.
- adhamsalama 2y agoPython keeps the types at runtime, that's why no TypeScript framework will have a developer experience anywhere near something like FastAPI.
- code_biologist 2y agoFirst party runtime types would be nice, but zod has become pretty much the standard answer for projects that need it. Not complicated.
- adhamsalama 2y agoTell me how to have automatic documentation and validation like FastAPI using anything in Node.js and I will use it immediately. Note: NestJS isn't it.
- code_biologist 2y agoDo OpenAPI Swagger docs count? That seems to be the route a ton of the ecosystem takes. trpc, ts-rest, and express-zod-api all explicitly build on zod and can do validation + Swagger UI generation. hono looks like it doesn't do that by default, but single-source-of-truth validation + Swagger UI are available as middleware via `@hono/zod-openapi`.
- BoorishBears 2y ago
- qwertox 2y agoPlus three months of recording/cutting/editing the video. Well done.
- TechDebtDevin 2y agoThe video is very impressive by itself. This guy is a perfectionist
- deleted 2y ago[deleted]
- Ericson2314 2y agoNot to be a grouch, but I feel like this could be way more optimized
- rvnx 2y agoIt's a bit that it is oversold, but it's a cute little VM. https://github.com/MichiganTypeScript/typescript-types-only-wasm-runtime/blob/master/src/main.rs https://github.com/MichiganTypeScript/typescript-types-only-... Though the fact that the actual converter that converts from WASM to TypeScript types is in Rust makes it lose a bit of charm, but still. Like Flappy Bird in TypeScript types did: https://zackoverflow.dev/writing/flappy-bird-in-type-level-typescript/ https://zackoverflow.dev/writing/flappy-bird-in-type-level-t...
- abound 2y agoIt is open-source, you are of course more than welcome to take a crack at it.
- undebuggable 2y agoHonestly every time I worked on TypeScript codebase and the type definition "any" started popping out more and more often, I felt I'm starring into the abyss.
- epolanski 2y agoThere are valid use cases for any (such as type constraints). Playground with example here: https://tinyurl.com/5ahs366a https://tinyurl.com/5ahs366a
- undebuggable 2y agoThat was the tipping point in transition from "we are serious and use static typing instead of lame JavaScript" into "ok we lost control over this thing".
- epolanski 2y agoWhat do you mean? This is perfectly sound and valid from both a practical and theoretical pov. Which is why I was pointing out that there are scenarios like constraints where any not only makes sense but is the correct type.
- tyilo 2y agoSeems to also work without any: type Values<T extends Record<string | number | symbol, unknown>> = T[keyof T]
- epolanski 2y agoSure, there's many other ways to type it, but none adds any kind of additional safety or strictness over Record<any, any> which was my point that `any` is the correct type in many cases, except when it widens a type. But in my case it's not widening anything, in Record<A, B>, B can already be `any`thing. People tend to see it as an unsafe escape hatch (which is how it is abused), but it's just a set of all possible types.
- TechDebtDevin 2y agoYour only miss is that you should be selling that "Types" Doom themed shirt.
- mormegil 2y agoHere you are: https://shop.squiggle.tools/ https://shop.squiggle.tools/
- TechDebtDevin 2y agoTy!
- ourmandave 2y agoMicrosoft Solitaire is apparently the most installed program. Doom must be the most ported.
- ejones 2y agoAmazing work. I'm interested in the choice of WASM - presumably any target that can run DOOM could've been used? Of which there are innumerable choices I assume. Was it for symbolic reasons or genuinely the most useful target?
- wvenable 2y agoWASM is the easiest target because you don't have to emulate an entire computer.
- svieira 2y agoBut in this case he kind of did anyway (at least the video makes reference to "L1 Instructions Cache").
- wvenable 2y agoBut that's all CPU -- he doesn't have to emulate the rest of the computer (video card, IO systems, etc). You provide WASM with your own interface to the outside world.
- dimitropoulos 2y ago(not arguing, really just want to hear your thoughts to this!) so re: video card - but I did write what I don't know what else to call other than "a graphics driver" (i.e. it takes Doom palette pixel values and converts them to something the user sees on their screen with ASCII art). what else would you call that? or are you saying video card would have to be at the level of VSCode or my operating system that actually lights up physical pixels on my screen.
- wvenable 2y agoIf instead of WASM you decided to emulate a different DOOM target like a PC then you'd have to emulate the actual VGA graphics hardware and enough of the other PC hardware to run the game. That level of emulation is a difficult project on it's own.
- layer8 2y agoI wonder if there will come a time when the HN audience will stop being amazed that some system is Turing complete, or that any Turing-complete system can run Doom (barring resource constraints). Maybe I’ve just seen it too often. The fact that TypeScript’s type system is Turing-complete was shown back in 2017 [0], and then of course you can run Doom on it. [0] https://github.com/microsoft/TypeScript/issues/14833 https://github.com/microsoft/TypeScript/issues/14833
- __alexander 2y agoI think you missed the part about how much effort they put into it.
- graynk 2y agoThere’s a difference between a _system_ being Turing complete and something actually _using_ that Turing-completeness to make something arbitrary run on it. You can’t deny this is an impressive effort.
- layer8 2y agoIt’s a considerable amount of work for sure, but that alone doesn’t make it impressive. Maybe there were particularly difficult hurdles to overcome that were solved in novel ways? But I don’t see such noteworthy aspects being mentioned in this thread, and it’s not evident at all that there should be any.
- kristiandupont 2y agoOh come on, are you seriously being blasé about this? What could ever impress you?
- rvnx 2y agoA time-travel machine would be really impressive, I would give all my money for that, and even upvote the thread.
- 2y ago
- ravenstine 2y agoOne of the top comments in the video: > If this guy goes for a big tech interview they're still going to ask him how to invert a binary tree The industry's hiring process is so messed up that this is completely believable. "We've decided to prioritize other candidates, as you are strong in the fundamentals but lack the kind of experience in Vue that we're looking for."
- brap 2y agoI’m 100% sure that if he was being considered for a domain expert role in some domain related to this (e.g. TypeScript) his score in a typical whiteboard interview wouldn’t have been a deciding factor whatsoever. This is a standard hiring track even in big tech. Sometimes you’ll even be exempt from these interviews altogether. But if he was being considered for a mid level generalist role, yeah, none of this would’ve mattered. And why should it?
- turnsout 2y ago> But if he was being considered for a mid level generalist role, yeah, none of this would’ve mattered. And why should it? As someone who has been on the hiring manager side, I'll state the obvious: because it demonstrates insanely good problem-solving skills that would transfer to nearly any challenge.
- jf 2y agoWould he have made it past your recruiter screen though?
- SXX 2y agoA lot of people who have a gap between jobs for 1-2 years because they worked on their insane projects certainly wouldn't.
- soulofmischief 2y ago
- zeroq 2y agoFrom YT comment section: >> @TimMattison >> If this guy goes for a big tech interview they're still going to ask him how to invert a binary tree > @MichiganTypeScript > So actually in the "why" video, you're going to hear about exactly that! I was looking for a job during working on this and absolutely got some disappointing rejections, and one was because of my lack of skillset on things like this in a big tech company's interview. I literally failed the technical screening. Oh well.
- kibwen 2y agoHe's also one of the principal organizers of SquiggleConf, a conference focused on devtools that takes place in Boston: https://2024.squiggleconf.com/about https://2024.squiggleconf.com/about What I'm saying is, if he still happens to be looking for a job, any employer reading this should be falling over themselves to recruit this man.
- karparov 2y agoThere is more to hiring than technical competence. I'm not seeing any red flags in his videos, but just saying, ability to work in a team is not obvious from such posts.
- dimitropoulos 2y agostrong agree! so much of it boils down to "do you treat people good and stuff". then there's "do you treat yourself good and stuff", and then a tiny little fraction that's "can you work hard to get to an answer" and finally, least of all, "what do you know"
- sponnath 2y agoI think what's more important is a company's / team's ability to onboard new hires to their way of working (so what you should be testing is humility and open-mindedness). Ability to work in a team is such a vague measurement when different teams have different ways of working with each other.
- 2y ago
- cod1r 2y agoi envy dimitri's ambition and capabilities. i want to be able to dedicate that much effort and more into something I'm passionate about. mostly personal discipline/skill issues but MAJOR props to dimitri and this awesome project.
- sunnybeetroot 2y agoIf you decide to have kids that’s a great long term project.
- dimitropoulos 2y agoI'm glad you said this actually, because I had a section in the "why" video where I tried to compare this project to how I've felt having kids and cut it out because it was too cheesy. maybe I'll bring it back!
- adriancooney 2y agoPlease do.
- ajkjk 2y agoI wonder if there are any small changes/improvements to TS that would make this orders-of-magnitude more efficient to run? It would be fun to go implement some random TS feature with the secret sneaky goal of making it run Wasm better.
- rvnx 2y agoArithmetics were apparently integrated into TypeScript types for that exact reason: https://note89.github.io/typescript-typelevel-tic-tac-toe/ https://note89.github.io/typescript-typelevel-tic-tac-toe/
- dandsupernig 2y ago[flagged]
- 4gotunameagain 2y agoThroughout the video and while appreciating this unbelievable feat I kept thinking "how could someone have the motivation necessary to tackle such an insurmountable undertaking" ? And then he said it: "All I wanted was the specific reason DOOM can't run in a type system but every time I hit a roadblock I always came up with some ridiculous workaround. I clung to that belief that it couldn't work and that doubt fuelled me the whole time." Beautiful. I wonder if I can trick myself to one time attempt the impossible.
- whoisthisguy 2y agomad respect! you are a legend.
- pinoy420 2y ago[dead]
- pinoy420 2y ago[dead]
- g4zj 2y agoCan someone help direct me toward an understanding of what it means for something to be "run in/by TypeScript types"? A short explanation or link to a resource would really be helpful. :)
- mahoro 2y agoNormally you would write a program that is a game of Doom when you run it (you create a program, then compile it and run). Dmitri created a program that does nothing and he don't even run it. But while it's compiling, it does a lot of tricky things to make typescript compiler to run Doom as a side effect. It's extremely hacky because Typescript is not even a runtime, it's not meant to run any code at all. Typescript is a thing that takes .ts file and produces .js file (which you then run using different program - a javascript runtime).
- svieira 2y agoTypeScript types are a kind of Prolog [1] (sort of, kind of, not entirely). Like any language they have primitives (`boolean`, `string`, `true`, 'Manchester'), functions (`type WaitWhat<T> = { yesReally: T }`), variables (`type X = number;`), and conditionals (`type Huh<T> = T extends Foo ? Bar : Baz`). You run the types program by asking `tsc` to check the types of some program - e. g. `type Foo<T extends number> = { x: T }; type Bar = Foo<string>;`. Getting output out of the type system other than via "hover over the type in VSCode" is probably a bit more involved, but it's definitely doable (I suspect some abuse of the Language Server Protocol here). [1]: https://en.wikipedia.org/wiki/Prolog https://en.wikipedia.org/wiki/Prolog
- pcthrowaway 2y agoIt might be helpful to look at something like Typescript Tic Tac Toe in the type system [1]. You can comment out individual lines in the GameLoop type, and then hover over `____________DISPLAY___________` to see the current game state. Illegal moves will result in type errors. Running Doom in the type system effectively means a lot more types have been generated (effectively a C to typescript-type compiler was created if I understood this correctly), then the game was started with no inputs entered. Theoretically if the author had infinite time and compute resources, the history of control inputs up to a certain point in play could be put in a tuple, and the type system would generate the state of the game given the code and the moves which the user had input so far. This state would include what's on the screen, but also internal state variables controlling things like where the enemies were moving, whether projectiles are in air, their direction, collision detection, etc. [1]: https://tsplay.dev/wE95vw https://tsplay.dev/wE95vw
- syrusakbary 2y agoHats off to the creator big way. Really amazing stuff, and impressive dedication. To the author: if you would like to work on challenges of similar caliber, ping me (I'm Syrus, from Wasmer)
- dimitropoulos 2y agoWOW that's quite kind of you to say! As luck would have it I happen to be the happiest at my current job than I've ever been ever (and by a lot) buttttttt if it's interesting to you one of the express goals of SquiggleConf is to get WebAssembly to be a "oh I know how to use it" tool in the everyday dev's mind. So I'll definitely ping you some time soon to see what you think (and I hope you can tell I'm not sponsor shopping! even if you have people building wasm tools web devs should know about and you can point them towards our CFP that would be huge! we really want great wasm coverage to widen the playing field for everyone). Also -> actually Wasmer does have a small part in this whole story with Doom, too, which is sorta neat (will come up in the next few videos!).
- AndreasMoeller 2y agoThis was the best thing I saw all day
- kgeist 2y agoThe next challenge could be making TypeScript types run an LLM. I wonder how their performance would compare to that of Excel sheets.
- franky47 2y agoThe subtle Devin Townsend references in the video were a super nice touch, Dimitri is literally a Power Nerd.
- dimitropoulos 2y agoI don't have any tattoos, but if I did, it would most definitely be of the world's ultimate cup of coffee!
- cytocync 2y ago[dead]
- porsager 2y agoAnd yet it's still not possible to type tagged template literals... https://github.com/microsoft/TypeScript/pull/49552#issuecomment-2276391450 https://github.com/microsoft/TypeScript/pull/49552#issuecomm... Insane achievement nonetheless!
- bobsmooth 2y agoAs someone that's unfamiliar with typescript, can someone explain exactly what was accomplished here?
- theThree 2y agoCan anyone explain to me what is "TypeScript types“?
- notfed 2y ago> "It was a brutal year long journey of 18 hour days" [to run doom in TypeScript types] This is some serious dedication for what at first blush may sound to many to be a completely unserious, or even useless, achievement. But I say to those people: a DOOM proof is just as worthy of praise as any other academic mathematical proof, and has the advantage of being verifiable by laymen. Congrats on this amazing achievement.
- 38 2y ago[flagged]
- stevage 2y agoIt's obviously for the person who did it.
- digdugdirk 2y agoPushing the frontier is an end unto itself. The pure excess of this endeavor is a huge feat, and I for one am happy to enjoy just witnessing it.
- tracerbulletx 2y agoThe video will probably do pretty well, giving him some personal traction for his channel or reputation. Also because hackers gonna hack.
- kaonwarb 2y agoHe wanted to do it. Didn't hurt anyone. Why criticize?
- DrammBA 2y agowhat's with hn being filled with assholes lately?
- chamomeal 2y agoThe amount of “why would somebody waste their time with this” comments is pretty surprising. This guy is a legend now. Every developer slack channel at my company is buzzing about it
- internetter 2y agoOut of curiosity, could the learnings/toolings from this project have real improvements to more "practical" TypeScript?
- dimitropoulos 2y agoyes! I completely skipped over it in the video for time, but the performance benchmarking tooling I had to make to is something everyone can benefit from, and I'm excited to find someone that sees how big it'd be for the TypeScript world if we can extract some of that (I'll need help!!)
- internetter 2y agoI work with a couple type-dense libraries: Elysia and Kysely. Kysely holds up remarkably well. Elysia... Well... Elysia is a backend framework like express. As you construct your routes — annotating the input structure and return types, it constructs a HUGE MEGA TYPE, that you can then use with a thin query client: https://elysiajs.com/eden/overview https://elysiajs.com/eden/overview If I recall, the query client uses proxies. I did something similar before, this one is a much smaller codebase: https://github.com/boehs/ajar https://github.com/boehs/ajar But as you can imagine, typescript does begin to lag when your routes enter the hundreds
- dgunay 2y agoI am at the same time both amazed and utterly unsurprised that this was possible, given all the hullaballoo about TypeScript's type system being Turing complete. Having the grit to actually go through with it though? Bravo.
- akkad33 2y agoI have seen papers saying at least Java and Python type systems are turing complete. I wouldn't surprised if all type systems are turing complete
- mseepgood 2y agoNo, good language designers take care that their type system is not Turing complete.
- pornel 2y agoIs there a mainstream language where this still holds true? From what I've seen most languages don't want to have a Turing complete type system, but end up with one anyway. It doesn't take much, so it's easy to end up with it accidentally and/or by adding conveniences that don't seem programmable, e.g. associated types and type equality.
- anon25783 2y agopretty sure the C type system is not turing complete, but that doesn't necessarily make it superior
- akkad33 2y agoCan you give an example of such a language that is type safe (which removes C)
- flanbiscuit 2y ago"But I'm not one of those fancy 10x developers. Instead of a master of craftsmanship, I'm more a master of close-enough-manship" I definitely relate to this comment. and he also says "It was a brutal year long journey of 18 hour days" I think people are looking for those unicorn 10x devs that are like Good Will Hunting for code, but forget that there are those devs that might not get things right away but never stop until they figure things out. You'll probably find a lot more of those than the unicorns
- ipaddr 2y agoThose are the unicorns
- 1oooqooq 2y agosociety create the überman myth to keep the working class down, thinking they will never be the top of their game. the ones doing the hiring know that those putting in 18hrs a day are the unicorns, i.e. the best they can hope to find.
- JohnMakin 2y agoI’m close to one of these types and I get taken advantage of a lot and desperately wish I could turn it off. It presents in weird ways that are hard to navigate politically - often I will end up on a team and be outputting a large majority of the work, people/egos get hurt or threatened, still inevitably make the same anyway. It's never really led to any kind of career or financial success I'd have thought it would have years ago.
- anonymous3411 2y agoYou are halfway there my friend. The other half is tactful self promotion. Make sure your skip levels see what you’re doing. Do a little less for your team and a little more for other teams and make sure their leads know you’re helping. Become the legend you can and it will result in much success. Output is only half the picture.
- stevage 2y agoWow. I still don't quite understand what it means to run Doom in the type system. I can sort of get how you might trick it into doing some calculations and generating some ASCII art. But how do you get tsc to access the audio system or load files etc?
- paulryanrogers 2y agoAt 17TB, trillions of types, and a year of 18h days my guess is he got very creative.
- raincole 2y ago*177TB, according to the video.
- AdieuToLogic 2y agoGenerative Programming[0] FTW! 0 - https://en.wikipedia.org/wiki/Automatic_programming#Generative_programming https://en.wikipedia.org/wiki/Automatic_programming#Generati...
- Sharlin 2y agoI don't think it's actually playing audio or loading files. The required game data (.WAD) was presumably pre-transformed into the encoding that the virtual machine uses for data and passed to the program as type-level "input". Edit: Playing music isn't really relevant here anyway given that it took 17 days to load the level and display the first frame, and that's as far as the author took it. He says that subsequent frames would likely have "only" taken an hour or so each - giving about 0.0003 fps.
- dimitropoulos 2y agono audio - correct. technically, in a certain sense, the first frame will contain only one sample of audio, and I did consider that, but a single impulse is the definition of "juice wasn't worth the squeeze", haha. re the .WAD - the types-only-wasm-engine doesn't know anything at all about Doom (it only knows about what to do with WebAssembly) so actually the .wad is embedded in the WebAssembly exactly like you see in any regular WebAssembly Doom project (e.g. https://diekmann.github.io/wasm-fizzbuzz/doom https://diekmann.github.io/wasm-fizzbuzz/doom). There's more to say about what "the WAD" means in this case, because it's a very minimal WAD - but it's all open source and I'll be explaining that in great depth soon!
- einpoklum 2y agoI'm sorry to rain on this parade, but I fail to see the merit of spending so much effort - and writing so much code, generating so much data, working 18hr days etc. - to render Doom in TypeScript type-checker. I mean, there all sorts of feats and achievements one could choose as one's goal, which would also be impressive, but would be more useful to users and/or software developers, than this. I'm just thinking of all of those times I wanted to suggest a software tool to someone and went "ungh, if there was only some FOSS which did that" - and there wasn't, or at least, it wasn't assebled from pieces into something usable. Then I think about spending a person-year on this and I get frustrated. Sorry, but those are my 2 cents.
- saagarjha 2y agoYes, but think of how much joy it brings to so many people.
- einpoklum 2y agoThink of how much joy it would bring to people if the author would work on a piece of software which would be consistently useful beyond the one-time novelty. Of course, it's a matter of proportion - I'm not saying that only things of utility and no "fun" stuff need ever be produced; but this is a rather extreme case.
- saagarjha 2y agoProbably less.
- dimitropoulos 2y agohi! author here! this doesn't rain on my parade at all! actually I really appreciate what you're saying, so thanks for saying it! until yesterday, I did this whole thing in isolation (aside from a few of my close friends in a then-private-now-public discord channel patting me on the back every few days when I'd get stuck with no idea how to get unstuck). I realize that what I'm going to say next will be alarming to some people, but as nice as it is to hear all these wonderful just super heartwarming things from people over the last day (thank you!!) I have a kind of brain that would have been roughly equally satisfied if after completing it, I closed VS Code and never mentioned it to anyone again. For a different example, I used to spend most of my time making music and being in many bands and whatnot and I have, not exaggerating, like 200 hours of unreleased finished music - some even with album art (back when we had CDs haha). Probably 50 hours no one but me has ever heard and 50 hours only my wife has heard in the background while I worked on it and the rest just close friends. But when my close friends urge me to just release it... I just.... why? I do really really love to share, and I have (all the MiTS music https://soundcloud.com/michigan-typescript https://soundcloud.com/michigan-typescript is open source with the BitWig sets available https://github.com/michigantypescript/music https://github.com/michigantypescript/music), but it honestly doesn't bring me a lot of satisfaction. Creating though... just simply creating and learning how to do new things brings me just a tsunami of satisfaction. I don't know how else to explain it. I'm just wired this way. I can't help it. It's like breathing. If I am lucky enough to grow old, I'm gonna be the grandpa in his basement with all the oscilloscopes trying to fix a Ham radio, even though I have no purpose for fixing it. I can tell you already. That said, I'm relived to say that when it comes to this Doom project I learned SO SO SO many things that have been VERY VERY directly applicable to my career as a software engineer. In that way, ALONE, it was worth the effort. It's like multiple times per week that I'm able to help or contribute to something at my company with my team that was a skill I picked up on this project. I've contributed quite a lot over my career to FOSS and I can tell you that many of the most useful contributions really started in really strange places with strange motivations. What's beautiful is that none of that matters to the user - they see functions and functionality and never know what's behind the curtain for why someone was motivated enough to really make it happen. So to cap it off, I'd say, that actually what you're seeing in this Doom project is literally the best possible path to get what you say you want. There's nothing commercial about this, but if it gets people excited and gives people energy and capabilities to contribute to FOSS (even if it's just me, the author) - then now yer' cookin with gas.
- breadwinner 2y agoI hope the TypeScript team at Microsoft sees this and goes: "What have we done! We have created a monster... we need to tame and simplify this beast. Or at the very least stop adding more features."
- danbruder 2y agoit is so beautiful
- Zamicol 2y agoThe big lesson from 1936 Turing: Anything can run DOOM... ...as long as it's Turing complete.
- breatheoften 2y agoI wonder if with 177TB you could implement DOOM in a regex ... (plz don't try unless you want to be on top page of hackernews in a year!)
- sn9 2y agoTypescript's type system is Turing Complete (at least it was for 2.2) [0]. Regexes fundamentally can't do that [1]. [0] https://github.com/Microsoft/TypeScript/issues/14833 https://github.com/Microsoft/TypeScript/issues/14833 [1] https://en.wikipedia.org/wiki/Turing_completeness https://en.wikipedia.org/wiki/Turing_completeness
- hardwaregeek 2y agoA strict theoretical regex yes, but a lot of regex implementations in practice are not strict NFA/DFAs and may indeed be turing complete
- extraduder_ire 2y agoI think GP meant PCREs when they said regex. Ar at least the subset of them that doesn't embed perl code.
- lerp-io 2y agoidk why ppl do this to themselves, likes?
- merillecuz56 2y ago[dead]
- steezeburger 2y agoIs the background music the music from Batman Beyond? lol
- dimitropoulos 2y ago"the only thing they fear is you" but the incredible, honest, humble, hard hard-working, Mick Gordon.
- steezeburger 2y agoOh haha well now I feel dumb. Of course it is! The high pitched sounds are similar to the Batman Beyond intro. I can hear the djenty riffs better now though. Sick video!
- dimitropoulos 2y agothanks!
- khazhoux 2y agoIt should have been obvious this was achievable once you realize that a monad is merely a monoid in the category of endofunctors!
- AdieuToLogic 2y agoA Turing complete[0] language can do just about anything any other Turing complete[0] language can do, even if the language used is a language's own type system. Mad respect for the author. This is a non-trivial achievement indeed. Bravo! 0 - https://en.wikipedia.org/wiki/Turing_completeness https://en.wikipedia.org/wiki/Turing_completeness
- AlienRobot 2y agoYeah of course it can it's just j... Jesus christ.
- harha_ 2y agoThese typescript fanatics never fail to make me feel disgusted by what they've done...
- harha_ 2y agoPeople who downvote me clearly lack any sense of humour.
- dimitropoulos 2y agoit's just so hard to tell sometimes - but thank you for clarifying that you meant it in a jokey way!
- pmkary 2y agoI had once built a type checker for a query language within the TypeScript type system, I thought I have reached the limits. Actually showed it to the TS team and they felt the same. This is like something my mind could never had even swallowed, let alone be able to ever build! Nice job!
- pulkitsh1234 2y agoApparently, this guy tried to apply to BigTech to get a job but was rejected. > "I was looking for a job during working on this and absolutely got some disappointing rejections, and one was because of my lack of skillset on things like this in a big tech company's interview. I literally failed the technical screening. Oh well." I mean... I don't have words...how f*cked up is the interview process ??
- big_paps 2y agoThis is top bloat and reminds me of the fever-dreams as a child with walls and walls of senseless work… impressive but also sad somehow.
- replete 2y agoWhat are the minimum system requirements in order to run this at 30fps?
- dimitropoulos 2y agoit was done on an 13900k system with 128gb ram. I bet the performance would be very different on other systems. and by my calculations the next frame would only take like maybe an hour or so to render. so that means that actually, hilariously, if anyone wanted to really dig in and make the engine faster - which I suspect it can be done by multiple orders of magnitude, truly - then actually I'd say 30fps types-only-doom is possible in the next maybe year or two. the TAS-style keyboard controls will work, but one problem is definitely going to be "how do you refresh a screen" which is a problem I didn't attempt to tackle other than to say you could (with what I already built) just hover your mouse over another type that contains the information for frame 2.
- replete 2y agoFascinating. Just for fun, comparable compute (by cpumarks) to your 13900k for 30 fps would be 39,600+ 96-core AMD EPYC 9655Ps. Bravo on the project success!
- dimitropoulos 2y agoyou know what's funny, I also have a threadripper rig (which is my main development rig) and it ran _slower_ than on the 13900k. Like. by a lot. and while that surprised me at first, it's makes a lot of sense because this is Node.js in the end (i.e. the TypeScript typechecker runs within Node.js) and that means it's single threaded. So single-threaded perf is all that matters.
- replete 2y agoThat figures. It was fun though to pretend it would scale across processors. Were you tempted to fork the typescript compiler in this project to add some optimizations or something crazier like gpu acceleration for rendering or parallel workloads? Reminds me of the guy on Youtube obsessed with optimizing Mario64 code, he found really interesting things like how removing optimizations made the game faster - presumably because the very basic tooling the original developers had made it hard to measure things across the board, and also not making the most of the powerful hardware architecture.
- thebeardisred 2y ago"Man demonstrates Turing completeness of TypeScript in the most extreme manner possible."
- wildpeaks 2y agoI'm crying of laughter, it's magnificent
- linwangg 2y ago[dead]
- juhanakristian 2y agoThis is amazing!
- vid 2y agoThe big question is, would the author lose interest if they were working on something mission critical?
- johnfn 2y agoIs that really the big question? Why is it necessary to find another dimension along which to diminish the author?
- vid 2y agoI'm not diminishing them, I am in awe of their work, I'm just pointing out that sometimes people (including myself) focus on esoteric projects that might have some learning opportunities, but don't directly solve a real problem (and might just be psychological mechanisms).
- dimitropoulos 2y agohi! author here! it's taken me many years to be able to self reflect enough to produce these next few words, but the answer is I have learned about myself that I perform better under pressure. I'm more consistent, reliable, and make better decisions when it's go-time. so I guess the answer to your question _should_ be yes. although.. I've noticed I have other flaws that have burned me many times in responding to incidents. Oh well. The one I've been working on for years is "when the system is down, check the status page of the upstream provider first because it might not be your fault". I always assume it's my fault for way longer than I should.
- vid 2y agoI totally understand. When I have a project with a months timeline that I know can be done more quickly, I spend a lot of up front time exploring areas that might be helpful, or might just be interesting on their own. A friend called this process "annealing." It does bring more creative and sometimes breakthrough solutions, but I find we are in a world where development creativity is subjugated to more top down controlled ideas (which can often lead to a 'race to the bottom' for the users in a startup culture focused on exits)
- mohas 2y agoStop this madness!
- xnavra50 2y agoInsane.
- johnniedegen 2y agoit's cool you can use it as engine for your own doom-like games in ts
- johnniedegen 2y agohowever you need lots of terrabytes storage lol