diff --git a/docs/highlight.js b/docs/highlight.js index b9f9616..566fa1a 100644 --- a/docs/highlight.js +++ b/docs/highlight.js @@ -64,7 +64,7 @@ function highlightSolstice(code) { const word = code.substring(i, end); // Check what type of word it is - if (['def', 'if', 'while', 'return', 'ground', 'puts'].includes(word)) { + if (['def', 'if', 'while', 'return', 'ground', 'puts', 'def', 'struct', 'new'].includes(word)) { result += `${word}`; } else if (['input', 'print', 'println'].includes(word)) { result += `${word}`; @@ -87,7 +87,7 @@ function highlightSolstice(code) { } // Check for operators - else if ('+-*/=!<>'.includes(code[i])) { + else if ('+-*/=!<>:'.includes(code[i])) { let op = code[i]; if (i + 1 < code.length && '='.includes(code[i + 1])) { op += code[i + 1]; diff --git a/docs/index.html b/docs/index.html index b4e5399..e4d696c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,6 +18,8 @@
bool: Either true or falseThe type signature of a function looks like this:
+fun(argType, argType, argType) returnType
+ The type signature of a template looks like this:
+template(fieldType fieldName, fieldType fieldName, fieldType fieldName)
+ The type signature of an object looks like this:
+object(fieldType fieldName, fieldType fieldName, fieldType fieldName)
+ Solstice statically checks types at compile time to ensure your data is used as intended. These are the details of the type checker.
@@ -137,6 +148,18 @@ while number < 10 {Note: Structs, templates, and objects in Solstice are currently in beta. A lot of work in the type checker has been done, but accessing fields is still an issue.
+In Solstice, you can create a struct to group various bits of data together. You can specify default values for each field with : or =.
struct Person {
+ name: "John"
+ age: 32
+}
+ This struct generates a template named "Person" which can be used later to generate new objects.
+You can use the new operator to create new instances of templates.
max = new Person
+ Since Solstice is built atop Ground, you can write Ground code inside Solstice code, usually to wrap a Ground function for the Solstice standard library.