blob: f9c087c7e9d807db988d01c1d5ebd270b955369a (
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
|
Aliasing syntax
===============
There are two types of aliasing:
1. items that alias *something*, so reads/writes need to be done in order
with regard to external or other accesses to aliased items.
2. items that alias a specific other item. This is useful for shallow
copy functions, for example.
Syntax for case 1:
- simply a qualifier
- this probably only makes sense when there are function pointers
inside an object, that may modify the object.
func f(aliased Obj a)
func g(Thing b) -> aliased Obj # Does it make sense at all for return values?
Syntax for case 2:
- could work similar to lifetime specifiers:
func f(Obj a, Obj b)
aliasing a, b
func g(Obj a) -> Obj
aliasing a, return
- which separator token to use?
aliasing a, b
aliasing a & b
aliasing a/b
aliasing a+b
aliasing a b
Simplified solution
-------------------
* Disallow the "aliased" qualifier, and only use "aliasing" specifiers.
* Regarding internal aliasing:
- Do we need to specify it at all? The struct would have aliasing
specifiers inside it anyway.
- If yes, which syntax to use:
- "aliasing internal a"?
- or specify which fields? "aliasing a.f1, a.f2"
|