Choreographic Programming in Rust

(github.com)

49 points | by o8vm 1 day ago

13 comments

  • sebastianconcpt 3 hours ago
    I really wish our culture to explain the applicability of the things we invent would be way way waaaay stronger.

    Abstractions should be earned.

    Not because executing them is expensive but because understanding them is.

    • alethic 1 hour ago
      Choreographic programming is well-known within the programming languages literature, which is the audience this README is intended for. The level of detail here is fine, not everything is written with being posted on news.ycombinator.com in mind.

      To explain it briefly though, choreographic programming is a method of writing distributed programs that communicate in some message-passing fashion by -- rather than writing separate programs that communicate with send/recv and must be very intentionally designed to be in sync -- you have /one/ unified messaging primitive. In a typical distributed system, you might have something like A.send_to(B) / B.recv_from(A). In a choreographic system, you'd rather have something like A ~> B, where send_to and recv_from are /projected/ from ~> into separate programs during the process of compilation.

      You might want this kind of abstraction for various reasons, but the biggest is that many choreographic systems offer a guarantee of deadlock-freedom. This isn't without tradeoff. At the moment, choreographic systems (and session types, another distributed abstraction) are very bad at handling any kind of failure / degraded performance over the network. There is active work within the PL community on resolving these issues, but for now, choreographic programming is primarily useful for prototypes, rather than production systems.

  • zanderwohl 5 hours ago
    I would really like the README to be revised in human English. Claudish makes my brain averse to absorbing the information.
    • rhodey 4 hours ago
      IMO the README is not Claudish, this project is in an area that is more "computer science" than "coding" and there is simply a high bar on whats needed for prior knowledge. I think you could say ELI5 "Explain Like I'm 5" and it probably is possible to do so, but I don't think its correct to say "claudish".
      • snitty 3 hours ago
        Pangram rates it (up to "This README is arranged by responsibility:") as 100% AI generated. I'm struggling to disagree.
      • zanderwohl 3 hours ago
        I read it and I understand it, but the style of the writing is anathema to me.
      • xhevahir 3 hours ago
        I'm noticing an awful lot of tricolon, i.e., naming things in threes. Ive gotten the impression that LLMs are really fond of that device.
    • taylorius 5 hours ago
      "It's some form of Claudish, I can't read it."

      "There are few who can. The language is that of Opus 5, which I will not utter here... In the common tongue it says... err.. actually I don't know what it says."

      • elendilm 3 hours ago
        That brought a smile to my face. Nice one.
      • boredatoms 4 hours ago
        we need an AI generated movie remix video for this one
    • amelius 4 hours ago
      Can't they train these LLMs to produce human-readable English?

      And human-readable code, for that matter.

      • alethic 1 hour ago
        Not well. Xiaomi published a detailed report of their RL process for their recent MiMo v2.6 model (https://news.ycombinator.com/item?id=49792730), which I read through recently. It is an interesting insight into how constructing RL environments work -- for some things, like code generation or code exploitation, there are naturally-perfect RL environments (Github issues + the closing PRs for the former, CVE databases + getting smaller language models to generate exploits triggering them for the latter) -- but for some other things, like code /quality/, Xiaomi at least (and presumably Anthropic et al.) simply do not have any objective criteria.

        So they generate a code "rubric" and give a model some number of gold stars for how "well" another language model thinks it satisfies specific enumerated aspects (for code, this is gonna be things like using language features idiomatically, compactness, etc; for writing, this is gonna be things like what you'd get graded on in writing assignments in the fifth grade). Incredibly stupid. I'm shocked it works at /all/. But the lack of any truly objective criteria of "quality" wrt. code/prose explains why it doesn't work all too well, IMO.

    • the__alchemist 4 hours ago
      I have no idea what this project does, and parsed none of the readme!
      • zanderwohl 3 hours ago
        It essentially lets you define a communication protocol where things have to happen in a certain order. At compile-time, your ordering is checked against certain rules, and certain classes of deadlocks and hangs can be avoided. The order of actions is then enforced at runtime.
        • the__alchemist 3 hours ago
          Sounds similar to imperative programming!
          • alethic 1 hour ago
            ... in what regard?
            • the__alchemist 27 minutes ago
              > things have to happen in a certain order. At compile-time, your ordering is checked against certain rules, and certain classes of deadlocks and hangs can be avoided. The order of actions is then enforced at runtime.

              This is how imperitive languages work. One line executes before the one below it as a default.

    • tensegrist 5 hours ago
      that's astrish not claudish
  • ch4s3 5 hours ago
    This seems to be a popular idea recently. After reading this paper[1] I ended up building this into my actor based language[2]. It makes a lot of sense in actor based concurrency, I'd be curious to know what rust devs think of this since it's a bit different from how they often do concurrency.

    [1] https://simonjf.com/writing/eventactors.pdf

    [2] https://march-lang.org/docs/choreography/

    • giancarlostoro 4 hours ago
      Have you looked at Microsoft Orleans by chance? I'm curious what you think of it. The concept is Virtual Actors by Microsoft research.

      https://www.microsoft.com/en-us/research/project/orleans-vir...

      I had Claude implement a similar one for me in Rust which I'm pausing for now, I'm prototyping a simpler version of Orleans in Go that I eventually want to port over to Rust as my v2 from scratch. The ideas in Virtual Actors reminded me a lot of Erlang, but simple to use in a language like C# I'm still surprised it didn't take off in other languages.

      Honestly, if Go supported message passing between processes and over the network out of the box, it would make for a slightly more interesting language, I still love Go though.

      • ch4s3 4 hours ago
        This is an interesting question! I'm not an expert in Orleans but I have looked at it alongside koka. The user defined key vs pid distinction is important and using a user defined key like in Orleans has advantages for keeping track of their virtual actors(grains). Their automatic lifecycle management is nice, but you really have to trust the runtime to know when something is really idle. I think their failure handling with auto state restoration is a mistake, recreating an actor with bad state is a recipe for crashes.

        What I have that Orleans is missing is compile time protocol checking, typesd and hash checked remote calls, capability management, cluster authentication, and no stop the world GC. Orleans doesn't have choreography per se, they have sagas as a convention.

        Yeah, GO routines are meant to solve different problems than share nothing actors.

        • giancarlostoro 2 hours ago
          Nice! I might have to check out yours sometime, I did think about converting a language I built up for .NET with a Python inspired syntax to treat Orleans as a first class citizen as an experiment to see if I could build a sort of DSL for Orleans.

          https://github.com/Giancarlos/Culebral

          I had to pause for now, been building other things I have wanted made for years with Claude, Culebral was my dive into seeing how 1 million tokens in Claude could accomplish, I think current state took under 1 or 2 million tokens from Claude total.

          I know it sounds silly, but the only .NET Pythonesque language I saw available is basically abandonware iirc so I wanted something that was more .NET specific so I could write less code to do the same as I would in C#.

          • ch4s3 2 hours ago
            That's pretty neat. I love the things I see people doing like this where they build up some cool functionality behind a nice and straightforward syntax.

            Yeah, claude can get pretty far into language projects on 1 million tokens.

    • dplyukhin 2 hours ago
      Wow, March is cool! Are you in touch with Ashton Wiersdorf? He been developing a choreographic programming DSL for Elixir, called Chorex: https://github.com/utahplt/chorex
      • ch4s3 1 hour ago
        Thank you, I really appreciate that!

        I'm not in touch with him, but I have looked at Chorex. I was hoping to see him at ElixirConf but I had to change my plans last minute. Have you used Chorex?

  • ashton314 3 hours ago
    If one of the humans involved shows up here, I have a few questions:

    How are you doing endpoint projection?

    What is your KoC strategy?

    What existing research systems (Choral, MultiChor, Chorex, etc.) did you take as inspiration?

    What benefits does your system have over ChorRus?

    • ashton314 3 hours ago
      Also: is this actually a choreography? Or are you doing runtime monitoring to ensure deadlock freedom?
      • o8vm 2 hours ago
        [flagged]
  • dplyukhin 2 hours ago
    Curious how this compares to Rust's existing choreographic programming library, ChoRus [1]. Those of you asking for motivation might enjoy the accompanying paper [2], which is really well written. Lindsey Kuper's group has done a ton of great work popularizing choreographic programming as a DSL.

    You can get even more power if you integrate choreographic programming directly into the compiler - for an example of that you can see Choral, an extension of Java that I've been contributing to for a few years [3].

    [1]: https://github.com/lsd-ucsc/ChoRus [2]: https://arxiv.org/pdf/2311.11472 [3]: https://github.com/choral-lang/choral

    • kooi 1 hour ago
      Just had a look. The OP library claims to be no_std compatible while ChoRus is not.
  • 6gvONxR4sf7o 2 hours ago
    I hope that eventually choreographic programming is baked into language runtimes to the point that it feels like manually placing certain data on certain parts of RAM/cache. It's one of those ideas that's great, but manual implementations always seem like a mess.
  • VeninVidiaVicii 2 hours ago
    The problem with Claudish and this README is that the whole thing is vapid text adding up to nothing in particular. When AI takes over a project like this it really has no goal.

    > Repeated regions add no iteration field to endpoint types, descriptor rows

    So what? Is this a goal or an admission? Is this something you implemented or what was done before?

  • Smoofer 4 hours ago
    multiparty session types are relevant to this: https://dl.acm.org/doi/10.1007/978-3-030-50029-0_8
  • o8vm 1 day ago
    Hibana now has the capability to build QUIC/HTTP3 in the manner of Hibana Choreography. Check it out here: https://github.com/hibanaworks/hibana-quic
  • snitty 3 hours ago
    Yes, but what does any of this mean?
  • latencyharbor 3 hours ago
    [flagged]
  • kirle_pg 3 hours ago
    [flagged]
  • poulpy123 2 hours ago
    Do you need to do an interpretive dance ?