aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/implicit_ref.txt
blob: c0492af434e3bb93ae9aaddc1777c7c86f3488f3 (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

Implicit references are probably a great thing for usability.
But there need to be crystal clear rules on how they should work
(both for the user and for the compiler).

In some cases, however, those have equivalent behavior. In that case,
the compiler can choose, as long as it is a local variables, parameter in a
private function, etc. In module interfaces, the ABI for the CPU/architecture
must decide this.

To prevent user from misunderstanding how implicit references work (and bad
coding styles), it should be forbidden to have "ref" qualfiers that are not
needed.

There are some special types of references: "arena" and "own".

There are also qualifiers that can apply to the reference itself:
"var", "writeonly", "out", "threaded", "aliased".

It should be as clear as possible what is meant when qualifiers are applied.
For example:
* A reference, that can be pointed to something else, to an immutable object
* A reference, that cannot be changed, to a mutable object
* A reference, that can be pointed to something else, to a modifiable object

Problem 1: Qualifiers
---------------------
Should there be different names for qualifiers that apply to the ref and to
the object? Or should the qualifiers be merged?

Syntax examples:
    modif Object o
    replac Object o