56 pointsby 0x19974 hours ago13 comments
  • satvikpendem5 minutes ago
    I commented this as well after having found it on Reddit, it's a very interesting project because I always thought TypeScript or at least some subset of it should be able to be compiled to native code, and it looks like others had a similar idea too, adding a "sound mode" to TypeScript, such as this project which is converting tsgo to Rust, also with LLMs.

    https://news.ycombinator.com/item?id=48189156#48189573

    https://tsz.dev/

  • ventana13 minutes ago
    I understand that implementing the TypeScript compiler is not the same thing as implementing all Node.js APIs, but still, advertising "no runtime" and then requiring JS runtime (and a full local Rust setup to compile it) for something as basic as an Express web server makes the "no runtime" claim look like a slight exaggeration. I'm not saying that it's bad, it's just that the website is too optimistic.

    Overall, it seems like every time I decide to try a vibe coded compiler I get this feeling like when you see a plate with fruits on a table but, coming closer, see that they are fake plastic fruits. No, I cannot use it to build a native binary of my project without V8 as easy as shown on the front page. Maybe some other project, yes, but not a real one.

    Unrelated: if a project is called Perry, should the icon be a platypus in a hat, you know?

  • jeswin42 minutes ago
    First of all, congrats.

    The website doesn't explain how it works in a lot of detail. I am the author of tsonic [1], a TS compiler that produces binaries via Clr NativeAOT (on Linux/Mac). The hardest parts were numbers (TS has no ints or shorts), Generics, and TS Utility Types. I've been on it for the last 6 months (almost every day); getting to near complete TS compatibility is a very long journey because of its expressiveness.

    Add: A request is to explain how it works on the website. I did take a look at https://www.perryts.com/en/internals/ but are those techniques described really sufficient to express TS? Based on my experience, I must say I'm surprised. But the proof is in the pudding, and if it's compiling those examples it must be working somehow!

    [1]: https://tsonic.org

  • afavour3 hours ago
    Fascinating. I've written cross platform (WASM, iOS, Android) libraries with Rust before and had a good time but Rust can be a pain too. Cross-platform Typescript is a really interesting proposition.

    That said, the more I think about it the more dubious I am. The site boasts no runtime dependencies but clearly it’s going to need things like a garbage collector, you can’t just magic that requirement away. At a certain point is it just doing what a JS engine’s JIT compilation does… except ahead of time?

    Also doesn't inspire confidence that the text on the site is very clearly AI generated and the GitHub log shows an endless stream of AI powered commits. About 15 per hour, every hour? Doesn’t scream stability.

    • metaquestionsan hour ago
      how do one tell when text is ai generated - honest question. What are the tell tale signs?
      • microtonal18 minutes ago
        Not X, not Y, just Z.

        The whole site is very jarring to read.

      • leidenfrostan hour ago
        In regards to the site, all of them follow almost the same templates.

        Once you see a few, it becomes obvious

      • mirekrusinan hour ago
        if /comprehensive/ then ai
    • __s3 hours ago
      tbf Rust also can spit out pretty big binaries for small programs
      • afavour3 hours ago
        Agreed. You can optimize things a fair amount with the Rust compiler, at least.
  • koteelok3 hours ago
    Calling a couple million lines of ai written Rust "stable software" is a bold statement
  • jeswin11 minutes ago
    > Traditional OOP runtimes use vtables for method resolution, adding a layer of indirection on every call. Perry resolves all method calls statically during compilation, turning interface method calls into direct jumps.

    What? How is this possible, even with something as simple as:

      interface Animal {
        speak(): string;
      }
      
      class Cat implements Animal {}  
      class Dog implements Animal {}
    
      function makeSound(animal: Animal) {
        return animal.speak();
      }
    • avaer6 minutes ago
      It's not possible, it reduces to the halting problem, unless you start restricting the Javascript/Typescript you allow.

      Otherwise the best you can do is be solid on common special cases. Which is what a modern (non-static) JS/TS runtime is.

  • evil_buzzard3 hours ago
    the claim of "no runtime" is a bit dubious... you're telling me that you're statically linking a full, modern UI library into every app?
    • avaer9 minutes ago
      A runtime is needed for GC, unless you're fundamentally changing Javascript. Even golang has a runtime.
  • fookeran hour ago
    Why go through LLVM at all?

    There are a bunch of tools that JIT somewhat optimized assembly.

    • silverwind10 minutes ago
      Yeah, a missed opportunity. But I'm sure such a compiler will eventually arise.
  • 0x19974 hours ago
    • koteelok3 hours ago
      The screenshots in the showcase look goofy
  • madanparas2 hours ago
    Perry uses NaN-boxing to preserve TypeScript's dynamic type system at runtime, the same approach as JavaScriptCore. The PERF_ROADMAP is honest about the cost: 1.86x behind Zig on image convolution, with 1.24 billion wasted instructions traced specifically to NaN-box unboxing. You cannot get C-level performance without dropping TypeScript semantics, and dropping them means you are no longer compiling TypeScript.
    • Dylan168072 hours ago
      I think you mean you can't get that performance without monomorphization. When you know the types you can...

      ...wait, I went and looked up that file.

      "The Three Optimizations That Would Close the Gap"

      You're presenting the data from there in an extremely misleading way! They in no way need to drop any Typescript semantics to go faster.

      • cornholioan hour ago
        Typescript is a dynamic language. Without changing the language, there is fundamentaly no way to resolve at compile time decisions that can be made only at runtime (ie, they are data driven). Monomorphization helps pin down (some) dynamic types but the fundamental problem remains.
        • nielsbot43 minutes ago
          Why don't JITs preserve previous work across runs of the same code?

          If you encounter code with the same hash as last time, load up the previously generated binary and run that... or is that already happening?

        • mirekrusin42 minutes ago
          Julia?
          • cornholio8 minutes ago
            That's a JIT. Yes, you can do all sorts of optimizations in a JIT, because you do it at runtime using runtime information, and always keeping an escape hatch that is invoked when the static code is invoked with data it was not compiled to handle. This kind of hatch is used here with <any> wrapping.

            JIT is a technique to accelerate dynamic languages at runtime to near machine performance while keeping dynamic ergonomics; but it can't transcend the AOT / runtime wall.

      • madanparas2 hours ago
        You're right. The typed buffer locals optimization keeps TypeScript semantics intact by exploiting the existing Buffer/Uint8Array type annotation to skip the NaN-unbox. It's not dropping types, it's using them. The floor I described applies to any-typed paths where static type info isn't available. For well-typed TypeScript, the roadmap shows the gap closes without semantic changes.
        • drawfloat44 minutes ago
          Put the LLM down and talk to humans as a human.
  • __s3 hours ago
    Curious where on spectrum compiling to wasm falls between art project & optimization potential. Should be able to make some nice interfaces between TS-wasm & TS-web
  • smasher1642 hours ago
    I'm not against AI usage but the website, documentation, and even the comments the creator (proggeramlug) makes in response to questions are all very clearly AI-generated. Also, as someone else noticed, the pacing of the commits is eerily fast. That combined with the level of functionality makes me dubious how much accountability the creators have over the implementation.

    Like you really built a backend that lowers to LLVM, integrated it with a generational gc, wrote a cross-platform reactive runtime, and built support for eleven different targets within like a year? Are you just prompting the model to tack on the next coolest thing or do you understand how these features work?

    I worry how many of these kinds of projects will show up now. How do you guarantee stability? If there's a memory corruption error in the GC implementation, who's going to debug it?

    • fookeran hour ago
      This is how software development works now. We have to live with it.

      The models are good enough that this works.

      You can keep disagreeing for a while, but know that almost all the code in the industry is written like this now.

      • manquer35 minutes ago
        Trust of a project long term always was and continues to be of concern when choosing a critical dependency .

        The concern basically boils down to how large and serious is the team and what if they abandon the project in few weeks or months .

        These were always the risks, many here have been burned by betting years of their career building against promising but what turned out to be weak projects

        OP is alluding to the fact that today commit frequency, lines of code or how active the contributors in the issue trackers are no longer good signals to use as proxy.

        When the underlying project to yours is few million lines of code written by machines only it is not going to be feasible fork and maintain or in-house it if the maintainers abandon it

        To be clear users of a library or a tool aren’t owed anything when it available gratis and fully open source .

        However not everyone has access to unlimited tokens to disregard the quality (in terms of history and usage ) or size of the underlying project completely

        • fooker17 minutes ago
          I think the primary value of a project like this is the demonstration that this is possible and a proof that it does not incur some unknown tradeoff you'll discover after spending resources doing it.

          I think the maintenance story is more or less solved if you can keep AI agents refactoring and improving it in a loop.

          > However not everyone has access to unlimited tokens

          Apologies. I did not consider this when writing my comment, being spoilt by unlimited 'free' AI.

          Free in quotes because, presumably, training agents on AI usage from developers is worth more than the cost of providing free AI.

      • rzmmman hour ago
        I have used AI agents extensively for coding and my experience is that it's fine for prototypes, but in large projects like this there is risk that the codebase becomes unmaintainable.
        • fooker30 minutes ago
          This is a very popular opinion that is sort of obsolete now in my opinion.

          It was a valid concern last year. We have seen tremendous progress on this in the last 4-6 months.

          Even if your initial prototypes are unmaintainable slop, the state of the art models are fairly good at refactoring and fixing things.

  • haeseong3 hours ago
    [flagged]