An unofficial, read-only Hacker News reader.

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

343 points by todsacerdoti 2 days ago | blainehansen.me | 320 comments on HN

View full thread · View on Hacker News

Comment thread (3)

  1. The issue with Haskell and other functional programming languages is that it doesn't reflect the hardware paradigm. Reasoning within a functional programming language is obviously simplified due to the statelessness, however you lose the benefits of memory hierarchies and other hardware improvements we have due to spatial and temporal locality. You might be able to fix this with a smart compiler, but then reasoning about the correctness will be another challenge.

    If a language cannot balance tradeoffs between hardware and software, people will still use the most performant language, especially for resource-intensive tasks, so you end up with what we currently have. We need to rethink how we can design a language that is token-efficient, offers memory safety, is close to the metal, and lastly implements formal verification guarantees. The closest what we have to this is Rust and C++, but it's not good enough.

    Replies (2)
    1. > however you lose the benefits of memory hierarchies and other hardware improvements we have due to spatial and temporal locality.

      This is ironic considering the default GC strategy for GHC's RTS is a copying collector that puts values physically close if they are used together plus bump allocation. That has good cache side effects (heh).

    2. Linear type solve a lot of this problem. Idris2 have https://github.com/stefan-hoeck/idris2-ref1 which has been proved to be efficient