An unofficial, read-only Hacker News reader. Join the beta →

The need for a formally verifiable mainstream programming language (opens external site)

338 points by todsacerdoti 1 day ago | blainehansen.me | 308 comments on HN

View full thread · View on Hacker News

Comment thread (17)

  1. Wow, I feel like Blaine is describe a language a lot like the one I'm working on now, Zena: https://zena-lang.dev/

    I started Zena from wanting a TypeScript-like syntax that compiled to very efficient WebAssembly GC, and AssemblyScript had issues...

    The motivation for targeting Wasm was as a good sandboxing and orchestration unit for AI-generated code. So, out of both general PL curiosity and enthusiasm, and an attempt to make a language that's good for AI generation, I started adding what I thought were the best features from other languages with a lot of focus on correctness, structure, and optimizability: pattern matching with exhaustiveness checking, ADTs and sum types via sealed classes, value types, async cancelation / structured concurrency, ownership and borrow checking for resources, unicode safe strings, and recently I added runtime contracts and I'll start on refinement types and some kind of proof system soon.

    The idea is exactly to take a mainstream and familiar-looking language and add more cutting-edge and academic features that help with software correctness.

    I wrote about some of this here, though not the formal methods parts: https://zena-lang.dev/blog/2026/09/languages-for-the-ai-era/

    Replies (4)
    1. This looks interesting, I've been wanting a TypeScript-like language which compiles to native without all the baggage of JavaScript. Does it also support generating native binaries, or only WASM?

      edit: I looked at the features on the website, I don't see anything about multi-threading, is it supported? And how about interoperability with native libraries like SQLite/QT/etc?

      Replies (1)
      1. It only supports Wasm for now. There are Wasm-to-native compilers, like Wastrel [1], which is my preferred approach to supporting native, but I haven't tried it yet. I don't think it would be too difficult these days to plug into LLVM either, but that greatly complicates the toolchain. Right now the compiler and every related tool runs as Wasm.

        WebAssembly is pretty core to my main goals with Zena though: being able to run plugins, generated code, on-demand loaded apps, and other untrusted code is the whole reason why I use Wasm, and wanting a great language for Wasm is the whole reason I'm making Zena. Compiling to native would leave a lot of that out.

        There's no multi-threading or any parallelism yet. Wasm GC doesn't support threads yet, and that's a while out if it ever lands, so we'll need some kind of worker/actor system. I don't just want to copy JS workers though, since those are so difficult to use. I'm much more interested in the type system encoding whether data is parallel-safe so I've been working on ownership/borrowing, value types, and immutable types to hopefully come together to form a one-writer / multi-reader, or shared immutable data, worker API, enforced by the type and borrow checker.

        [1]: https://www.wingolog.org/archives/2025/10/30/wastrel-a-profl...

        Replies (1)
        1. Thanks! I am not a Rust programmer but I hear that it has a pretty safe and solid multi-threading system. Might be something you can take inspiration from. Also, Kotlin coroutines are nice, but I am not sure if they are true multi-threading or just single-thread like JS. Overall the project looks nice, definitely filling a gap in the language ecosystem.
    2. > Parsing, IR lowering, and scope resolution are all embarrassingly parallel

      Embarrassingly parallel?

      Replies (1)
      1. Replies (1)
        1. Yep. And in this case you can parse, resolve symbols, and lower each file without information from other files.

          Preserving that is one reason Zena has a very explicit import syntax and uses `this.x` like JavaScript: you have to name every symbol you import, and dereference all class members explicitly, precisely so you don't need other files to know if an identifier is valid.

          In a non-shared-heap language like Zena (because of Wasm GC), the question then becomes if the serialization cost of collecting those results into the checker thread pays for parallel parsing. So far it doesn't, so I haven't built workers for Zena just yet. That'll probably happen when I make the checker parallel.

    3. Claude: 1,262 commits, 941,484 ++/598,077 --
      Replies (2)
      1. Your comment seems to imply something specific, but I guess you didn't mean to say "I have worked so little with AI that I think it's still as bad as it was back in 2022" which is what I understood from it.
        Replies (1)
        1. this genre of comment always sits poorly with me; i've been hearing this month after month year upon year as if i haven't been watching the whole time, perfectly capable of periodically trying out the trendy hotness from 6 months back i was assured obviated each and every concern of the ignorant luddites. and yet it continues to fail in similar, pathetically trivial ways. but by then there's a new obviously better model and nothing about the old one is considered admissible. rinse and repeat.
          Replies (1)
          1. I mean I think you’re just incorrect: LLMs write code just fine. They write better than most engineers and most code is much higher quality. Mostly because LLMs can dedicate time to testing - engineers can’t.

            There’s a reason basically every engineer at every company on Earth is using LLMs to some degree. Yes, it’s very very good for programming.

            Obviously I can’t one-shot things and if you give it stupid prompts it will give you stupid output. That won’t change, ever. But that’s not a failure mode either.

            You need to prompt at the right level of abstraction and carefully think about design. And if you do, it will produce higher code than you can by-hand in 1/100th the time. And, with unit tests, fuzzing tests, differential tests… the whole works.

            Replies (1)
            1. i see no particular reason to expect that i can trust that pile of code and unit/fuzzing/differential tests when i can go use a 750B+ parameter model i heard vociferous praise for earlier this year whose marketing materials brag about agentic capability, 1M+ token context, and unrivaled coding proficiency only to immediately have it fall on its face attempting basic pronoun-antecedent resolution that relies on trivial information a hairs-breadth back in the context window. we apparently all decided natural language is all you need but squint as i may i can't seem to make out the perfect natural language processor everyone else must be using.

              what possible reasonable basis would i have to doggedly charge forward assuming that these immediately apparent issues with the basic language-processing-facsimile aspect of things will suddenly no longer be of concern when it's instead gnarly subsystem-spanning crosscutting concerns i expect to be tracked usefully across an entire codebase? particularly when things like parameters are to arguments as pronouns are to their antecedents which makes up but one tiny inherent subproblem of "okay computer design it good".

              i'm certainly open to the argument that i'm just a weirdo who is simply not engaging with these things the same way as everyone else which may reveal a different set of problems invisible to most people's usage of the same tools. on balance it would probably be somewhat better if everyone else is not simply choosing to ignore these blatantly obvious issues, but the fact remains that i do encounter them relatively consistently and so have to grapple with that disconnect (and have been trying to basically since i first took a post-gpt nlp course). unfortunately, i don't particularly expect that to be the case given how often i see the same kind of issues apparently slip past other people and make it out to somewhere i can see it, but hey i'd love to be wrong.

              anyway, i doubt i'll change your mind here and i equally doubt you'll change mine. not least because i just can't sustain enough intellectual respect for your side of the argument to take it particularly seriously given my own experiences. now, do i love the implications of that if you're right and your side nevertheless represents the unquestionable vast majority? obviously not, but here we are.

              (also i believe you are missing a word somewhere in the semantic vicinity of "quality" in the middle sentence of that last paragraph unless the goal is indeed for language models to help my code experience mind-altering states on my behalf in the grand tradition of automating away the fun parts)

              Continue this thread (1 replies) →

      2. Yep. Though I started with Gemini and am using a lot more Gemini now.

        This is the language I've wanted to make for many years, but it wasn't really tractable without a full team. This project would not be possible for me without LLMs.

        Also, if we're talking about making a language that's better for AI-generation, it seems extremely reasonable that such a language might be built with AI, no? I would be surprised to find someone who wanted a great language to use with AI, but was a stickler about the language itself not being built with AI.

    4. This doesn't seem formally verified? (And as a new thing you're working on, inherently not mainstream.)
      Replies (1)
      1. Indeed, it's just the plan and direction. There are designs for formal verification, but currently only runtime contracts and static contracts which aren't run and must be proved, but no proof system yet. I'm taking my time to try to understand the options better.

        As far as mainstream, I've usually taken that to mean in the same vein as mainstream languages, ie C++, Java, JavaScript, Python, Ruby, Rust, Swift, etc. Generally imperative, ALGO-style syntax, usually OOP + more and more functional, etc.

        I'm designing Zena to be as mainstream and familiar as possible in that sense of the word. Obviously a new language isn't mainstream in terms of usage yet.

        It's like a new band playing mainstream music. The band isn't itself "mainstream" at the beginning.