Unofficial Hacker News client - receive Push Notifications on replies.

Optimizing Rustc's next trait solver (opens external site)

212 points by g0xA52A2A 5 days ago | donsz.nl | 47 comments on HN | Vote on HN (opens Hacker News)

View full thread · View on Hacker News

Comment thread (13)

  1. It's interesting how much of the next gen compiler improves borrow heavily from logic programming. I don't know if any other compilers that have made the connection to logic programming as explicit as rustc.
    Replies (5)
    1. > I don't know if any other compilers that have made the connection to logic programming

      Which other compilers do you know?

      Replies (2)
      1. C++ compilers when doing a mix of template and overload resolution?

        Swift compilers when doing the same?

        Haskell compilers when doing the same?

        Idris, F*, Dafny, Koka,..... compilers doing the same?

        Replies (1)
        1. Did you mean to reply to me or the parent?
          Replies (1)
          1. That was the answer to

            > Which other compilers do you know?

      2. My C compiler rcc uses a handwritten solver in -O3 to solve contracts. I've tried z3 and others, but my own was way faster, no overhead. It's like MySQL vs sqlite in-proc.
    2. type systems correspond to logics so this tends to be how it goes
      Replies (1)
      1. Types are pretty much like values, except at compile time instead of runtime.
        Replies (1)
        1. eh, usually a fairly large difference is that only type resolution implements full unification in most programming languages with type inference.

          there are plenty of languages where types are also just values at runtime for which that's not a particularly helpful conception of things, as well as ones where you have all regular programming facilities at comptime

    3. I mean any compiler that has a typeclass system basically does the same, since there is quits a deep connection between the two.

      Of course any theorem prover will have an even deeper connection to logic in it's compiler and we've been building those since the 70s.

      Replies (1)
      1. Even those theorem provers that are not compilers.
    4. If you name it constraint based programming, it all makes more sense.
    5. There are compilers that use Z3 for type checking. I'd say that's even more explicit!