aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/own_tracking.txt
blob: 3a54377d0b00aebe7a221d79e4fe2d8af186eb19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Ownership tracking
==================

For local variables it should be fairly simple.
For structs it is trickier:

1. After construction but before first use (= passing into a function
   or storing in a variable/field), all non-optional refs MUST be
   initialized.
2. After using a field:
    - the field must be set to none, OR
    - the struct must be discarded
3. When setting a field:
    - the "source" of the field must give ownership, OR
    - the source must be set to none, OR
    - the source (or it's container) must be discarded