Actors for free #1281
Replies: 3 comments 7 replies
-
FTR, even though I'm a big fan of distributed Erlang and use it extensively, especially for infrastructure / internal computations, any matters regarding clustering are out of scope of this proposal. It focuses on guarantees achievable after a single compilation cycle. Here is an issue where clustering problems was brought up: gleam-lang/otp#9 |
Beta Was this translation helpful? Give feedback.
-
Where does this |
Beta Was this translation helpful? Give feedback.
-
Some really interesting stuff here! Thank you. If What does basis mean? Is it possible to design a supervision tree with this system? So that groups of processes can be considered a single unit and be restarted collectively if one fails? Why is it that there are only async messages? Does this imply no selective receives and no blocking receive? |
Beta Was this translation helpful? Give feedback.
-
Motivation
Actor model is notoriously hard to get right in types. While developing BEAM languages, an additional temptation to make a well-typed version of OTP is an additional distraction. Quoting @lpil (who is resistant to this temptation):
That being said, if there is a language that has a chance to succeed in this endeavour, then it is gleam. There are two reasons for this opinion.
This proposal "builds an actor model against a type system" in a way that relies on us targetting a runtime with BEAM properties, where fibers are extremely computationally cheap and are exteremly lightweight.
A neat side-effect of this proposal is that it happens to significantly improve UX of interacting with Gleam systems by allowing for named processes.
Proposal draft
Big picture
The final goal of this proposal is to create a system, where actors "just are". Meaning that if compilation succeded, then every actor that can be represented in code will be launched, be reachable and supervised.
Sketch
I have drafted code generation semantics on my Remarkable tablet, but before writing down the specification, I would like to get the sentiment from the commnity and maintainers. Thus, I present but a sketch of what should be possible shall this proposal be accepted.
Elaboration and an (un)educated guess on limitations of the implementation
!
and*
protocols produce named processes.^
protocol produces one named process, with the name of the receiver type. It then can be queried for a reference to a particular receiver, which represents given value.f(...) -> Sound ! Counter
) can be defined anywhere and then used innstead ofreceive
clauses.Open questions
type LongQuery * (SQL >= 25)
to say our program needs at least 25 instances of SQL actor)?Beta Was this translation helpful? Give feedback.
All reactions