The core process defaults and API should be different #81

Closed
opened 2025-07-06 13:41:35 +00:00 by scott · 2 comments
Owner

Here are a few different and orthogonal ideas for improving the process behaviour and interaction that's different than what Elixir does:

  • spawn! should link processes by default
  • links should only link panics, not returns
  • unlink! removes the link
  • fledge! is the equivalent of spawn! then unlink!
  • monitor! converts the link to a message, with the same tuple-shaped response
  • await! continues to panic if the exit isn't :ok
  • await! (xs) uses a fold to return a list of the results

And some more sugar for methods:

  • By convention, and again, this is only by convention, methods that end in a bang don't heed! a response, and methods that don't, do. E.g.,
    • turtle ::forward! (100) is a send-off
    • turtle ::position () is a send-heed or send-sync or whatever

This gets us a lot of the way to more ludusy ways of doing things.

Here are a few different and orthogonal ideas for improving the process behaviour and interaction that's different than what Elixir does: * [x]`spawn!` should link processes by default * [x] links should only link panics, not returns * [x] `unlink!` removes the link * [x] `fledge!` is the equivalent of `spawn!` then `unlink!` * [x]`monitor!` converts the link to a message, with the same tuple-shaped response * [x]`await!` continues to panic if the exit isn't `:ok` * [x]`await! (xs)` uses a `fold` to return a list of the results And some more sugar for methods: * By convention, and again, this is only by convention, methods that end in a bang don't `heed!` a response, and methods that don't, do. E.g., - `turtle ::forward! (100)` is a send-off - `turtle ::position ()` is a send-heed or send-sync or whatever This gets us a lot of the way to more ludusy ways of doing things.
scott added this to the Core: CC2 milestone 2025-07-06 13:41:35 +00:00
scott added the
design
label 2025-07-06 13:41:35 +00:00
Author
Owner

Add a stay_alive!() function:

fn stay_alive! () -> receive { _ -> stay_alive!() }
Add a `stay_alive!()` function: ``` fn stay_alive! () -> receive { _ -> stay_alive!() } ```
Author
Owner

First bit done, as of a444f789f3

First bit done, as of https://alea.ludus.dev/twc/rudus/commit/a444f789f3f4626a638675d49d43b778a13aedc3
scott closed this issue 2025-07-06 23:41:17 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: twc/ludus#81
No description provided.