X-Git-Url: https://ocean-lang.org/code/?p=ocean-D;a=blobdiff_plain;f=Ocean-operators;h=d70058b19df36c9832cc463ab6f9b2cd4bf8aeeb;hp=8a5fa36cd370f59c7bf9cdd518b8245bcbbd472a;hb=5a245ff2b74c48d2a50cc8d6f4529ef5abb84837;hpb=83f7f2eae2f646ef67bb024ec50d1a3a4443de04 diff --git a/Ocean-operators b/Ocean-operators index 8a5fa36..d70058b 100644 --- a/Ocean-operators +++ b/Ocean-operators @@ -67,6 +67,9 @@ What types do operators act one? 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. @@ -74,3 +77,49 @@ What types do operators act one? 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.