tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

30 lignes · 716 octetsBrut · Historique
1// `Subject` is opaque (ADR 0072): only `process.subject` makes one, so a
2// subject's tag always carries messages of its type. `select` relies on it
3// within an actor, and distribution across hosts.
4
5import std/process.{type Pid, type Subject, type proc}
6
7fn forge :: owner: Pid -> Subject<Int>
8{
9 process.Subject(owner, 1) //~ ERROR E0117 `Subject` is opaque
10}
11
12fn retype :: s: Subject<Int> -> Subject<String>
13{
14 process.Subject(..s) //~ ERROR E0117 `Subject` is opaque
15}
16
17fn read_owner :: s: Subject<Int> -> Pid
18{
19 s.owner //~ ERROR E0117 `Subject` is opaque
20}
21
22fn accessors :: s: Subject<Int> -> (Pid, Int)
23{
24 (process.owner s, process.tag s)
25}
26
27fn made :: -> Subject<Int> / <proc>
28{
29 process.subject ()
30}