]> ocean-lang.org Git - ocean-D/blobdiff - Blog-JamisonCreek
updates
[ocean-D] / Blog-JamisonCreek
diff --git a/Blog-JamisonCreek b/Blog-JamisonCreek
new file mode 100644 (file)
index 0000000..b2bd53b
--- /dev/null
@@ -0,0 +1,78 @@
+
+I moved home recently ... where "recently" is actually about 6 months
+ago.  I'm using the extra demands on my time involved in buying a
+house, packing up contents and unpacking at the other end, as an
+excuse for not making progress on this project for a while.  But the
+excuse if over, and coding has restarted.  I, at least, and happy
+about that.
+
+I've just tagged a new version - Jamison Creek - in honour of my new
+home.  The main advance in this release is that types are starting to
+take shape.  I had intended to implement various flavour of numbers -
+integers and floats of various sizes - when I first did types, but it
+didn't turn out that way:  they are actually rather complex as they
+have subtleties that need to be worked out carefully.  I needed
+something simpler to flesh out the infrastructure for types, so I've
+just extended to current built-in types of "number", "string" and
+"Boolean" with arrays and structs.
+
+The syntax for declaring an array is different from what I proposed
+earlier.  Had I used `[number:12]` for an array of 12 numbers, then an
+array of 12 arrays of 3 numbers would have been `[[number:3]:12]`
+which is ugly.  That could be fairly easily abbreviated as
+`[numer:3:12]` but the indexes are backwards: the last element would
+be `foo[11][2]`, which would be confusing.
+So instead, arrays have the base type *after* the element count, and
+that count is enclosed in brackets, so `[12][3]number` is an array ofr
+12 arrays of 3 numbers, which I think works well.
+
+Structs use the same approach to block structre as complex statements,
+and they declare fields much like assignment declarations declare
+variables, so the initial value is optional.  So:
+
+       struct foo:
+               name:string="John Doe"
+               age:number=21
+               male:Boolean=True
+
+can also be given as
+
+       struct foo { name:string="JohnDoe"; age:number=21;male:Boolean=True; }
+
+These declaration are not part of code - in a `program` but come as
+separate declaration. `program` is now also a declaration at the same
+level.
+To flex out these declarations we can also have `const` at the
+declaration level
+
+I've introduced a few new operators too: `and then` and `or else` are
+short-circuit boolean operations which only evaluate the right hand
+side is the value is necessary to determine and answer.  There is also
+a trinary operator: `if ... else` which effects a conditional
+expression.
+
+As well as these language enhancements, I've added some proper
+regression testing.  There are a collection of small sample programs
+together with expected outputs, and a script that not only tests that
+the output is correct, but also:
+
+- uses valgrind to detect memory leaks
+- prints the program and ensure the printed program runs correctly too
+- ensures the printed program prints exactly the same as the original did
+- Uses the gcc coverage support to track the fraction of interesting
+    code lines that are being tests, and reports and error if this
+    drops below a set threshold, currently 94%.
+
+Hopefully it will be much less than a year before my next version is
+tagged.  Some things I have planned for the next version are:
+
+- Improved syntax error handling - particularly better messages and
+  better recovery.
+- development of 'struct', at least anonymous fields
+- a variety of numeric types
+- more operators: >> << op=  ???
+- pointers and memory allocation.  This will be the big change and
+  will probably get another blog post soon.
+
+
+Stay tuned...