aboutsummaryrefslogtreecommitdiff
path: root/notes/mutability_and_aliasing.txt
blob: a982983121cdd89fda66c5d7d75646f795517e8f (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

Mutability and aliasing
=======================

Require `var` on both local variable/parameter, and on any fields,
in order to allow modification.

Disallow modification once local variable (or parameter) declared `var`
is either:
* Stored in a field that is neither `var` nor `aliased`.
* Passed to a `keep` parameter
* Passed to a self-`keep` method

This should be sufficient for preventing fields that are neither `var`
nor `aliased` from being aliased (and thus preventing them from being changed
behind ones back).

Keywords to use?
----------------

Mutability:

    `var`
    `mut`
    `modifiable`

Aliasing:

    `aliased`
    `link`
    `linked`
    `live`
    `nonfrozen`
    `othervar`
    `ref`
    `view`

Keep:

    `keep`

Embedding (preventing pointer indirection):

    `embed`