]> ocean-lang.org Git - ocean-D/blobdiff - Ocean-operators
updates
[ocean-D] / Ocean-operators
index d70058b19df36c9832cc463ab6f9b2cd4bf8aeeb..a2b1ef90788d1d53ef0992c203daf51a927394eb 100644 (file)
@@ -9,7 +9,7 @@ I might want:
 
  Binary: and then, or else, integer division
  Prefix: int
- Suffix: dereference
+ Suffix: dereference (ref)
 
 
  Do I want  COND ? IFTRUE : IFFALSE
@@ -59,7 +59,7 @@ I might want:
       a @@= b
    does a deep copy
 
-What types do operators act one?
+What types do operators act on?
 
    numbers  + - * / %
    bitsets  & | ~ &~
@@ -123,3 +123,43 @@ 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.