X-Git-Url: https://ocean-lang.org/code/?p=ocean-D;a=blobdiff_plain;f=Ocean-operators;fp=Ocean-operators;h=8a5fa36cd370f59c7bf9cdd518b8245bcbbd472a;hp=0000000000000000000000000000000000000000;hb=83f7f2eae2f646ef67bb024ec50d1a3a4443de04;hpb=5b97b38c643628f0845dbfcf050f0b382b2f7ac3 diff --git a/Ocean-operators b/Ocean-operators new file mode 100644 index 0000000..8a5fa36 --- /dev/null +++ b/Ocean-operators @@ -0,0 +1,76 @@ + +Operators. +I currently have + +Binary: and or < > <= >= == != + - * / % ++ +prefix: not + - + +I might want: + + Binary: and then, or else, integer division + Prefix: int + Suffix: dereference + + + 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 one? + + 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? + + + 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!