]> ocean-lang.org Git - ocean-D/blobdiff - Blog-pointers
updates
[ocean-D] / Blog-pointers
index 372efc66b0ef889252e5f4fd610b9db42dff06ae..2539232ddae05443b331b93e01e327ac716f7311 100644 (file)
@@ -167,7 +167,7 @@ Rust uses smart pointers to implement
  others.
 It even has Box<> to create on heap instead of stack.
 
-Why doesn't I just do that?  Partly because I don't have classes yet!!
+Why don't I just do that?  Partly because I don't have classes yet!!
 
 I like a simple syntax to test if a pointer is over-loaded.
    if pointer?
@@ -241,3 +241,30 @@ or better
 
   fun foo<x:thing>(a:x, b:x) : x
 
+------------------------
+Years later - March 2021
+
+I need somewhere to start so I need to be able to ignore lots of this detail.
+So in the first instance all references are counted references.  They must refer
+to a struct that contains 'refcount'.
+
+A reference is declared with
+   name : ref base-type
+and the base object can be accessed with
+   name.ref
+though this can sometimes be inferred from "name".
+In particular
+   name.foo
+will find 'foo' either as an attribute of name, or of what name refers to.
+If name refers to a reference, this recurses.
+
+A ref can be checked with "name.valid"
+
+A new object can be allocated with "name.new()", which returns the ref.
+So "name.new().valid" is true if the allocation succeeded, which is always
+will on Linux.
+
+Future ideas might include:
+  type name : ref(attr,list) basetype
+where attr,list can include borrow,counted,single, etc
+