blob: bb7b3b3cf87b983523a0bc0268b5c17e4cc84423 (
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
|
Assignment and auto-deref
=========================
Cases:
pN: N pointers deep
int <- int lvalue <- direct
p1 <- int direct <- direct
p1 <- p1 lvalue <- direct (assigning pointer)
p1 <- p1 direct <- deref (assigning target value)
Syntax comparisons:
In C: In Pascal
p = p p := p
*p = *p p^ := p^
Syntax 1 Syntax 2 Syntax 3 Syntax 4
p ref = p ref p = p
p.value = p.value p^ = p^
Syntax 2 could be combined with auto-dereferencing only when the expr is
not E.field, E.method(...) or E[...].
It is still possible to use call-site qualifiers (var/aliased/arena/own...)
this.do_stuff(var x, own y)
????
What about the object itself?
Re-introduce sigills, but use them everywhere?
! = var, @ = arena, $ = own (but @ conflicts with address of, unless & is used instead)
?? = aliased, ?? = threaded, ?? = writeonly, ?? = out, ...
!ref int p
Using sigills for var and arena is simple:
this.do_stuff()
this.do_stuff!()
this.do_stuff@()
this.do_stuff@!()
Should reference specifiers appear at the call-site also?
Also:
Change assignment operator to <- ?
int x = 1
var int y
y <- 2
if x == y {
}
|