5 Binary: and or < > <= >= == != + - * / % ++
10 Binary: and then, or else, integer division
12 Suffix: dereference (ref)
15 Do I want COND ? IFTRUE : IFFALSE
16 or IFTRUE if COND else IFFALSE
19 provide the integer part?
21 What can I use '!' '@' '#' '$' '^' '&' '*' '|'
24 bit-wise and/or/not/xor
26 != is 'xor' for Boolean
28 I should use & | ~ for bitwise. and or not
29 ~ could be an infix for xor
33 += -= *= /= %= &= |= ~=
35 Do I want "#n" to be (1 << n) ??
37 ++ is concat. What about
44 || These last two are best avoided.
46 Pointers ... do I need a dereference operator?
47 Normally a pointer refers to the object it references (which isn't a pointer)
48 The only difficulty is
50 If a:foo and b:foo^ then b is dereferenced.
51 If a:foo^ and b:foo then a points to b
52 if a:foo^ and b:foo^ then a points to what b points to
54 So how do you change what a points to? I could have a de-reference operation
56 but I think I want a structure-changing assignment
62 What types do operators act on?
66 Boolean and or not "and then" "or else" "if .. else" What about and= ?? *= ??
67 string ++ < > == etc, regexp? strlen? append?
68 character? add to string? Convert to string?
70 are << and >> operators on numbers or bitsets?
71 can I just use "*# or /#" ??
74 What about error encoding? e.g. a pointer can have nil or other error encoded
75 A range-limited number could have extra codes outside that range.
77 convert error to type !error
78 test if value is error ?value
79 extract error code value!
85 could have a natural precedence:
87 A if C else B if q else a if c else b
89 A if C else (B if q else (a if c else b))
90 Hmm.. not what I imagined. But what I imaging suggested that left-association what
91 a op b op c -> (a op b) op c
92 requires that we reduce even when we could shift, ... maybe .... I should leave this
93 until I do precedence.
95 --------------------------
97 Thinking about bit operators.
104 which is bits 4 thru 11
106 I'm wondering if it is useful to have a field-select operator,
107 which could be '#' as infix (rather than prefix) so
111 would be an lval which can only modify the selected bits
114 would clear bits 6-11. Doesn't actually read very well, does it?
115 Probably better to use field syntax, with a way to declare fields for an int.
116 This would be a record.
121 to clear and set bits looks OK.
122 But ... what syntax do I want for test-and-set? More genericly cmpxchg.
123 An operator that modifies a variable is something I wanted to avoid.
124 var ? oldval = newval
125 could 'use false' if it fails.
129 + addition or abs value
130 - subtraction or negation
142 < > != == <= >= comparison
153 ^ bit invert (prefix or infix)
157 += -= *= /= %= ++= &= |= &^= ^=
158 What about boolean? and=?
159 if c: a=True // if not c: a=False
165 Equiv of "a ?: b". i.e. a if a else b. Only works if non-Bools can be tested.