]> ocean-lang.org Git - ocean-D/blobdiff - Ocean-types
updates
[ocean-D] / Ocean-types
index ed57f26d1407bee3baa002089d14bec3b85688fb..a89544cc3c87da1b04b679ff0cff88bc5d401720 100644 (file)
@@ -146,7 +146,7 @@ What do I do with
   add subtract multiply divide index
 ----------
 
- I currently have an enum of types that is used to test compatability
+ I currently have an enum of types that is used to test comparability
  and for propagation.
  This needs to change .... I guess I need a struct type* What goes in it?
   - name
@@ -167,6 +167,26 @@ What do I do with
      .Bool.true = a:char; b:char
      .Bool.false = ......
 
+  I like "inheritance" but that doesn't allow the size of the whole to
+  be known in advance.
+  I need a way to talk about which instance is active, even if the value
+  isn't stored.  So Pascal-like variant records are good.
+  Maybe a struct could be declared as 'extensible' and other structs
+  could 'extend', and it literally makes it bigger
+  struct a extensible {x1:int}
+  struct b extends a {y1:int}
+  struct c extends a extensible {y2:int}
+  struct d extends c  {z1:int}
+
+  now 'a' has room for x1, (y2 and z1) or y1
+  Which is used depends on context .. or by assertion on content.
+  So extensions can set values for existing fields
+    struct z extends a {x1=4; string c}
+
+  Syntax is a bit clumsy.  Do I need "extensible"??
+  
+
+
  Are enums just a fancy way of doing 'const'?
  I could have
    const: a=1; b=2; c; d