blob: 190f157a51cf115759872bb65548b68071637b52 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
Qualifier syntax
================
Current syntax:
int i
var int i
Obj o
var Obj o
var ref Obj o
var ref var Obj o
arena Obj o
Problems:
* The distinction between re-assignable ("var ref") and modifiable ("var")
might not be obvious for the programmer.
- But on the other hand, there is no such distinction for e.g. the
elementary types (int, bool, etc), enums, strings and "value" types.
* Whether arena access is given, is actually a property of the
reference(or parameter/variable) rather than the object.
For this reason, it would make more sense to put the arena
qualifier on the parameter/variable.
* arena access for allocation only and arena access for performing system
operations (such as I/O) is lumped together.
Alternative syntax 1:
int i
int =i
Obj o
var Obj o
Obj =o
var Obj =o
How to indicate that something is an "allocation arena"?
How to indicate that something is a "system arena"?
How to indicate that something is an arena and is modifiable?
How to indicate that something is an owned reference?
Syntax idea 1:
Obj +o # Allocation arena
Obj !o # System arena
var Obj +o # Allocation arena. Modifiable object
var Obj =+o # Allocation arena, re-assignable (changeable reference). Modifiable object
var @Obj o # Owned allocation
type T = struct {
ref var Obj o
# This ordering is a bit strange... (ref and = on opposite sides)
ref var Obj =p
}
Problem 1: This isn't that intuitive either...
Syntax idea 2:
Obj arena o
Obj sys o
var Obj arena o
var Obj arena var o
var own Obj o
|