‹ BackHN Continuity

Thread

Topcoat is pushing the boundary of server applications with Rust

113 points · 100 comments · sagacity

  1. muglug · · focus · HN ↗
    > Rust is the best general-purpose language for the new world of AI-driven development.

    Funny, the Python guys say Python is the best general-purpose language for AI and the Go guys say Go is the best general-purpose language for AI etc etc

    1. Tuna-Fish · · focus · HN ↗
      I've found that the guardrails of a strong, expressive type system are amazing for LLMs, especially if you don't use the top-of-the-line models but stick to the cheaper options. Agents need feedback to do their magic, and the type system is great for that.

      But on the other hand, the compile time of Rust is really counterproductive. On large, established projects, most prompts I write now spend more time compiling on my machine than they spend outputting tokens. In a way this is great because the tokens are the expensive part, but it does mean that when faster LLMs will come, they will not meaningfully improve iteration speed for me.

      I wonder how much of the compile time of Rust is inherent to the type system. There might be room for a language with slower runtime speed (GC?), but as good of a type system as Rust, so long as compile times are much faster. Switching languages has never been easier, anyone have any suggestions? IMO hard requirements are algebraic types and error handling based on them.

      1. jaen · · focus · HN ↗
        Python has a strong, expressive static type system with a very fast type checker (Pyrefly).
        1. selfhoster1312 · · focus · HN ↗
          I love python for some stuff, but i definitely would not say it has an expressive type system. Enums are a second-class citizen, and typed dicts are definitely not as convenient as i would like. And to my knowledge, type checkers don't support proper exception catching rules; rust also has no guarantee that a function won't panic, but usage of Result type makes it less of a problem (because panic is more or less exclusively for unrecoverable invariant violations), and there's ecosystem tools to make sure you don't ever panic.
          1. jaen · · focus · HN ↗
            If by enums you mean sum-type ADTs (like in Rust), then Python is certainly quite expressive - it has union types, which can represent polymorphic variants - those are slightly more expressive than pure Rust-style ADTs since you can arbitrarily subset or extend the enum cases.

              @dataclass @final class CaseA[T]:
                 field: T
            
              type MyEnum[T] = CaseA[T] | CaseB
            
            This also gets exhaustiveness checking in `match` statements (depending on the type checker). Overall, enums have a similar style to Scala and Java >=21 (mixing OO + ADT). I guess syntactically it can be slightly verbose depending on the exact situation... I wouldn't call them second class, but yeah, not a lot of existing libraries use this style.

            Typed dicts (with the latest PEPs) are an improvement over any other language besides TypeScript. Yes, in TS, certainly `Partial` / `Pick` / `Omit` and intersection types make modeling the web API swamp easier, and that's one place TS is superior to anything else.

            Python does have the Type Manipulation PEP 827 [1] out to give it similar powers to TS, but I feel that's unlikely to be implemented soon / as-is.

            Having an effect system for exceptions would be nice indeed. That's actually something I'm looking into (having an "allowed exceptions" annotation for functions and then checking it at test-time via failure injection and possibly in type checkers).

            [1]: <a href="https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0827&#x2F;" rel="nofollow">https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0827&#x2F;

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.