]> ocean-lang.org Git - ocean-D/blobdiff - Ocean-functions
updates
[ocean-D] / Ocean-functions
diff --git a/Ocean-functions b/Ocean-functions
new file mode 100644 (file)
index 0000000..9014d1a
--- /dev/null
@@ -0,0 +1,37 @@
+I want to add functions and procedures soon.  I should decide on syntax at least.
+
+The args to a function are effective a struct, so I want it to look the same.
+C doesn't allow "int a, b, c" in the parameters, which I think is clumsy.
+struct can be
+
+  struct name:
+     a,b,c:number
+     d:string
+
+So function might be
+
+   func name:
+       arg1, arg2: type
+       arg3: type2
+   returns type
+   do:
+       stuff
+
+A procedure is different as it doesn't have just a return type,
+it has a return structure.  So many C functions have 'ret' or 'result'
+variable that it might be nice to follow the Pascal approach of
+assigning to the function name??  or having
+
+    func name:
+       args:types
+    returns:
+       results:types
+    do:
+       statements
+
+A shorter version would be
+
+    func name(args:types;args:types):type { }
+or
+    proc name(args:types;args:types):(result:type;...) {}
+