ashton314
Has anyone done any choreographic programming with Elixir? The idea is that, instead of writing parts of a concurrent system separately and hoping that you’ve gotten the interactions between clients and server right, you instead write a choreography from some global viewpoint; a compiler of some sort then takes this choreography and constructs projections for each participant in the system.
A recent paper implemented an IRC client/server with choreographies: Real-World Choreographic Programming: Full-Duplex Asynchrony and Interoperability
Has anyone been working on something similar in Elixir?
Trending in Discussions
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
Hi there! :wave:
@frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #ai
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
D4no0
I’m not 100% sure we are not doing this already in Elixir.
Care to share an example of how this would look like in for example an imperative language like golang or similar?
ashton314
See page 5 for and example in a Java-like language: https://arxiv.org/pdf/2303.03983v3 (that’s a direct link to the Real-World Choreographic Programming paper)
D4no0
Makes a little bit more sense now. Building such a thing in elixir with metaprogramming is trivial, the other question is whether we need such a feature.
The processes from elixir are concurrent entities that implement message passing out of the box. That example could be implemented more or less with the features already present in Elixir.
ashton314
My question is this: has anyone made a library or tool that implements projection from choreography to endpoint?
UPDATE: I’ve looked around a little on hex.pm already and I didn’t find anything. Looking to see if anyone else knows more than I do on this.
D4no0
Highly doubt it, such concepts that involve a paradigm shift need to be extremely good for anyone to take them seriously. I can see how languages like Java could greatly benefit from it, however in Elixir I doubt this improves anything over existing way to write code.
ashton314
The chief motivation for choreographies is that they produce deadlock-free programs by construction, which is a pretty neat property. (See paper for details.) This is especially compelling for environments that need strong safety assurances.
Elixir—while providing higher-level concurrency primitives than, say, Java—doesn’t do deadlock-free construction natively.
fmn
yeah, i would say “we” do. it feels to me like actor model kind of stuff, sooner or later enters territory of orchestration or choreography.
i guess it comes with sufficient scale/complexity of the system.
ashton314
OK, so it sounds like you’re saying that you (@fmn and @D4no0) feel like choreographies are a common paradigm in Elixir code (I agree based on my experience) but that no one is doing mechanical endpoint projection. That’s good! That means I’ve got some work to do.
fmn
you could try to poke around slim intersection of “Elixir” and “BPM” / “Business Process Management”, no promises though
in Elixir software i was witnessed, it was quite often bit implicit choreography baked into application itself.
at the end, it might be a default way of going things, no? particular app/service/actor knows that “if i got this (pun intended) i do that” etc. and when you have bunch of apps/services/actors which just know what to do when something happens, well, you have choreography, i guess?
codeanpeace
At a high level, it sounds like this choreography overlaps quite a bit with OTP and the primitives it and Elixir provides out of the box. A choreography as I understand it captures both the participants at play and the types of messages passed between them.
For the first aspect, choreographing the participants at play translates to orchestrating processes and can be explicitly defined via Supervisors, DynamicSupervisors, and Supervision Trees.
Then for the second aspect, the types of messages being passed e.g. the security protocol notation used in choreographic programming e.g.
Alice.expr -> Bob.xcould be translated toAlice.expr -> Alice.call(Bob, {:expr, result}) -> Bob.handle_call({:expr, result}, Alice)assuming Alice and Bob were GenServers.As far as I know, there aren’t any guardrails in place that ensures all messages that are passed are handled/acted upon aside from test coverage. For asynchronous communication, a process “casting” with its message is totally happy shouting into the void aka it’s message “left unread” in the black hole of the receiving process’ mailbox so to speak. But when it comes to synchronous communication, a process “calling” with its message will get temporarily blocked if left unread and surface an error if the reply is used downstream so that generally gets caught pretty quickly. Regardless, preventing missing callbacks could be a potential area where choreographic programming would shine.
It seems like a fundamental value add from a dev experience perspective is how workflows can be expressed/encoded as a sequence diagram via choreographies and then translated into projections that represent the participants in those diagrams with the required send/receive functions defined. In my book, both ways of “framing” can be useful and being able to flip between the two depending on the situation would be pretty sweet.
For example, it would be cool if you could just write some choreography that uses endpoint projection to generate the proper Supervisor and GenServer implementations or biolerplate. On the flip side, it’d also be very cool to create an editable “virtual” file that stitches together the choreography for a specific workflow rather than rifling through multiple files/functions from a stacktrace.