ashton314

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?

Showing Posts 1 to 10

D4no0

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

ashton314 OP

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

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

ashton314 OP

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

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

ashton314 OP

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

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

ashton314 OP

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. :slight_smile:

fmn

fmn

you could try to poke around slim intersection of “Elixir” and “BPM” / “Business Process Management”, no promises though :slight_smile:

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

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.x could be translated to Alice.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.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Null-logic-0
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 Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews