Operators. I currently have Binary: and or < > <= >= == != + - * / % ++ prefix: not + - I might want: Binary: and then, or else, integer division Prefix: int Suffix: dereference (ref) Do I want COND ? IFTRUE : IFFALSE or IFTRUE if COND else IFFALSE Can / NUMBER provide the integer part? What can I use '!' '@' '#' '$' '^' '&' '*' '|' for bit-wise and/or/not/xor != is 'xor' for Boolean I should use & | ~ for bitwise. and or not ~ could be an infix for xor &~ could clear bits What foo= options? += -= *= /= %= &= |= ~= Do I want "#n" to be (1 << n) ?? ++ is concat. What about -- ** // - comment @@ ^^ && || These last two are best avoided. Pointers ... do I need a dereference operator? Normally a pointer refers to the object it references (which isn't a pointer) The only difficulty is a = b If a:foo and b:foo^ then b is dereferenced. If a:foo^ and b:foo then a points to b if a:foo^ and b:foo^ then a points to what b points to So how do you change what a points to? I could have a de-reference operation *a = b; a^ = b but I think I want a structure-changing assignment a @= b then maybe a @@= b does a deep copy What types do operators act on? numbers + - * / % bitsets & | ~ &~ Boolean and or not "and then" "or else" "if .. else" What about and= ?? *= ?? string ++ < > == etc, regexp? strlen? append? character? add to string? Convert to string? are << and >> operators on numbers or bitsets? can I just use "*# or /#" ?? What about error encoding? e.g. a pointer can have nil or other error encoded A range-limited number could have extra codes outside that range. Need to be able to : convert error to type !error test if value is error ?value extract error code value! PROBLEM?? a if c else b could have a natural precedence: A if C else B if q else a if c else b would be A if C else (B if q else (a if c else b)) Hmm.. not what I imagined. But what I imaging suggested that left-association what a op b op c -> (a op b) op c requires that we reduce even when we could shift, ... maybe .... I should leave this until I do precedence. -------------------------- Thinking about bit operators. #foo is 2^foo So #12-#4 is 1000000000000 - 10000 = 111111110000 which is bits 4 thru 11 I'm wondering if it is useful to have a field-select operator, which could be '#' as infix (rather than prefix) so var # field would be an lval which can only modify the selected bits var # #12-#4 = #6-#4 would clear bits 6-11. Doesn't actually read very well, does it? Probably better to use field syntax, with a way to declare fields for an int. This would be a record. Still. var &~= #4 var |= #4 to clear and set bits looks OK. But ... what syntax do I want for test-and-set? More genericly cmpxchg. An operator that modifies a variable is something I wanted to avoid. var ? oldval = newval could 'use false' if it fails. # decided so far: + addition or abs value - subtraction or negation * multiply / div % remainder ++ catentate () group if else conditional and, or, not Boolean and then Boolean or else Boolean = assignment : type < > != == <= >= comparison [ ] array access . field access " ' ` quoting , ; list { } grouping # expect & bit and | bit or &^ bit subtract ^ bit invert (prefix or infix) # 1<< (prefix) << >> shift += -= *= /= %= ++= &= |= &^= ^= What about boolean? and=? if c: a=True // if not c: a=False # undecided ? ! @ $ \ ~ -- ** @@ ^^ Equiv of "a ?: b". i.e. a if a else b. Only works if non-Bools can be tested.