]> ocean-lang.org Git - ocean-D/commitdiff
updates
authorNeilBrown <neilb@suse.com>
Wed, 8 May 2019 07:54:05 +0000 (17:54 +1000)
committerNeilBrown <neilb@suse.com>
Wed, 8 May 2019 07:54:05 +0000 (17:54 +1000)
00-TODO [new file with mode: 0644]
Ocean-operators [new file with mode: 0644]
Ocean-types

diff --git a/00-TODO b/00-TODO
new file mode 100644 (file)
index 0000000..7aa2fd3
--- /dev/null
+++ b/00-TODO
@@ -0,0 +1,33 @@
+This is a living document - delete things when done.  Avoid discussion.
+
+Current version (Jamison Creek)
+- more operators: and then, or else, if else
+- global consts
+- structs
+   - const or variable fields
+   - initial value
+   - anonymous field - array or struct (or pointer to these)
+   - [] can apply to anon array field
+   - anon struct field gets fields interpolated
+
+Next version ??
+
+- manifest values for arrays and structs [a,b,c]
+- yet more operators
+- split values so I can have an array of just the value (1 byte for u8)
+- integers, unsigned, bitfield, float
+- pointers
+   - owned or borrowed
+   - overloaded or pure
+- array slice
+- char, string search
+
+
+Much later
+- functions and procedures
+- per-field attributes
+- records
+- enum
+- classes
+- imports and exports
+- closuers, threads, co-routines
diff --git a/Ocean-operators b/Ocean-operators
new file mode 100644 (file)
index 0000000..8a5fa36
--- /dev/null
@@ -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!
index c25bd1be7ca16f3a9b418f97e7d938b8917e36f7..4aa4e8976565620b460e5440a0580297d57d1173 100644 (file)
@@ -278,3 +278,23 @@ Questions:
      a(args) is Call(a, args) - need a new Binode type - Tuple.
 
 So I have to delay 'const' assessment to later too.
+
+----------
+Where do type definition go?
+I don't think they go with statements, they belong separately.
+I don't want the full separation of a "type" section like Pascal
+So they probably go at the top level, equivalent to "program" - and before.
+They start with "struct" or "enum" or "record" etc.
+
+So: what about constants?  These are currently statements and so affect a scope in time.
+But for declaring arrays in structs, or initial values of fields, we might want constants.
+A constant could be within a struct, but only that it too limiting.  I need module-wide
+constants.
+So I guess:
+
+   const:
+      name ::= value
+      name ::= value
+
+or
+   const { name ::= value ; name ::= value }