summaryrefslogtreecommitdiff
path: root/docs/type_system/shared.md
blob: db8e6dc7bc1874f98094ac1661180a00390510ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Shared

---

Hold multiple references to the same object

```text
Shared[[LOCK] Type]
```

### `LOCK`

The shared type has been detected across asynchronous tasks and needs to lock the mutex on mutation

# Garbage Collection

A tracing mark and sweep garbage collector is used

# Mutating

```text
x : Shared[Array] $ (1; 2; 3)
^ x {[y]
    y `push 4
}
`log x // Shared[Array[I64]] $ (1; 2; 3; 4)
```