14 lines
253 B
Plaintext
14 lines
253 B
Plaintext
@module ref
|
|
|
|
ref value = Ref (spawn [ ! => loop value ])
|
|
|
|
loop value = receive [
|
|
.set new-value => loop new-value
|
|
p, id, .get => { send p (id, value); loop value }
|
|
]
|
|
|
|
@object Ref pid [
|
|
set val = .set val > send pid
|
|
get! = .get > send-wait pid
|
|
]
|