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
63
64
|
Syntax for "var" in types
=========================
Options:
var T var T %T var:T var&T
ref T ref T ref T ref T ref T
var ref T var ref T %ref T var:ref T var&ref T
ref var T rwref T ref %T ref var:T ref var&T
var ref var T var rwref T %ref %T var:ref var:T var&ref var&T
var+T var*T var~T var-T
ref T ref T ref T ref T
var+ref T var*ref T var~ref T var-ref T
ref var+T ref var*T ref var~T ref var-T
var+ref var+T var*ref var*T var~ref var~T var-ref var-T
In my opinion, the last one (var-T) is the best one.
It is obvious that var and the type that follows it belong together.
Is is obvious that "var" means variable, unlike %$: etc.
It is kind of obvious what "var-int i" and "var-ref int i" are.
Downsides:
* Not obvious that all types can have "var-" attached.
* Not obvious that "-" is special character.
These problems could be solved by ~, but on the other hand, ~ is harder to
type on most keyboard layouts (far away, or requries Alt Gr key press,
or requires swipe or long-press (on mobile keyboards)).
If using a "type sigill", which character to use?
!#$%&'*+,-./:;<=>?@[\^_`{|~
definitiely impossible characters: #",_
maybe impossible characters: *+-./<=>{}[]()
confusing characters: &?;^
!T $T %T &T 'T *T +T -T .T /T :T ;T <T =T >T
?T @T [T \T ^T `T {T |T ~T
combinations:
(T) <T> [T] {T}
This leaves us with:
!$%':@\`|~
common usages in other languages:
@T array, attribute
$T variable in PHP (not used on types)
%T
&T reference
?T optional type
'T
^T (or T^), pointer/reference
~T destructor, not
\T namespace in PHP, escape sequence. used in TeX
\T
ref T
ref \T
\ref \T
|