From 752b8583a2be93a345046eab868a8442e1202358 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Sun, 10 May 2026 19:11:39 +1000 Subject: [PATCH] Update docs --- docs/404.html | 20 +---- docs/automated_build_script.html | 20 +---- docs/basics.html | 20 +---- docs/build_dependencies.html | 20 +---- docs/building_manually.html | 20 +---- docs/code_layout.html | 20 +---- docs/command_usage.html | 20 +---- docs/comment_conventions.html | 20 +---- docs/comments.html | 20 +---- docs/expressions.html | 20 +---- docs/fornax.html | 22 +----- docs/function_definition.html | 20 +---- docs/functions.html | 86 ++++++++++++++++----- docs/hello_world.html | 20 +---- docs/index.html | 21 +---- docs/installation.html | 20 +---- docs/introduction.html | 21 +---- docs/naming_conventions.html | 20 +---- docs/operators.html | 20 +---- docs/prebuilt_binaries.html | 20 +---- docs/print.html | 93 ++++++++++++++++++----- docs/reserved_words.html | 24 ++---- docs/scoping.html | 20 +---- docs/searcher-c2a407aa.js | 2 +- docs/searchindex-5abcdab5.js | 1 + docs/searchindex-c4fb8585.js | 1 - docs/struct_definition.html | 20 +---- docs/structures.html | 20 +---- docs/{toc-1ef53d19.js => toc-5c5f5ceb.js} | 2 +- docs/toc.html | 2 +- docs/tutorial_comments.html | 20 +---- docs/tutorial_variables.html | 22 +----- docs/types.html | 20 +---- docs/values_and_types.html | 20 +---- docs/variables.html | 20 +---- docs/vela.html | 20 +---- docs/vela_0.1.0.html | 20 +---- 37 files changed, 214 insertions(+), 583 deletions(-) create mode 100644 docs/searchindex-5abcdab5.js delete mode 100644 docs/searchindex-c4fb8585.js rename docs/{toc-1ef53d19.js => toc-5c5f5ceb.js} (99%) diff --git a/docs/404.html b/docs/404.html index 1081b09..c85f6ea 100644 --- a/docs/404.html +++ b/docs/404.html @@ -36,10 +36,10 @@ const path_to_root = ""; const default_light_theme = "light"; const default_dark_theme = "navy"; - window.path_to_searchindex_js = "searchindex-c4fb8585.js"; + window.path_to_searchindex_js = "searchindex-5abcdab5.js"; - +
@@ -201,22 +201,6 @@ - - - +
@@ -238,22 +238,6 @@ - - - +
@@ -212,22 +212,6 @@ - - - +
@@ -223,22 +223,6 @@ - - - +
@@ -226,22 +226,6 @@ cd .. - - - +
@@ -211,22 +211,6 @@ - - - +
@@ -240,22 +240,6 @@ Args: - - - +
@@ -211,22 +211,6 @@ - - - +
@@ -238,22 +238,6 @@ def doSomething(int funnyNumber) int { - - - +
@@ -507,22 +507,6 @@ - - - +
@@ -213,22 +213,6 @@ - - - +
@@ -271,22 +271,6 @@ - - - +
@@ -175,6 +175,72 @@

Functions

+

Defining Functions

+

In Solstice, functions are a way to organise and reuse code. Here’s an example function:

+
def add(int a, int b) int {
+    return a + b
+}
+
+

Here’s what each part is:

+
    +
  • def: Means “define”. Tells Solstice we are defining a function.
  • +
  • add: This is your function name! Choose something unique.
  • +
  • (int a, int b): These are the arguments your function takes. +
      +
    • Enclose your argument type and name pairs in brackets.
    • +
    • The first identifier should be a type (such as int, string, etc), the second should be an identifer
    • +
    • After each type-name pair, add a comma unless you’ve got no more arguments to define
    • +
    +
  • +
  • int: This is your return type
  • +
  • return a + b: This is where your code goes for the function
  • +
+

Calling Functions

+

Call a function in Solstice like this:

+
myFunction(a, b, c)
+
+

where:

+
    +
  • myFunction is the name of your function
  • +
  • (a, b, c) are the arguments you would like to pass to the function. +
      +
    • Enclose the arguments in parentheses (( ))
    • +
    • Each argument should be seperated by a comma
    • +
    • Solstice will type-check each argument to ensure it matches the function’s specified types
    • +
    +
  • +
+

Closures and Scoping

+

Each function has an attached closure, which is the state captured at runtime when the function is defined. All variables in the closure can be accessed inside the function body, however the closure cannot be modified (meaning all variables captured remain consistent across function runs).

+

This behaviour ensures that functions are not affected by global state, and will always have reliable, consistent behaviour.

+

Additionally, all defined arguments are avaliable in scope.

+
x = 10
+
+def myFunction() int {
+    // Here, x is avaliable, however if we modify it,
+    // our changes won't affect the external state, or
+    // the state of this function when it runs.
+    puts x
+    x = 5
+    return x
+}
+
+myFunction() // returns 5, prints 10
+myFunction() // returns 5, prints 10
+
+puts x // prints 10, x has not been modified by myFunction
+
+

The type of a function

+

If you’d like to accept a function as an argument, you need to specify it’s type signature. That can be done like this:

+
fun(int, string) bool
+
+

where:

+
    +
  • fun tells Solstice we’re writing a type signature for a function
  • +
  • (int, string) is the list of argument types (names are not needed), seperated by commas, surrounded by brackets
  • +
  • bool is the return type
  • +
+

making this type represent a function which takes an int and a string, and returns a bool.

@@ -211,22 +277,6 @@ - - - +
@@ -224,22 +224,6 @@ - - - +
@@ -177,6 +177,7 @@

Introduction

Welcome to the Solstice documentation! Here we have a tutorial (starting here) and a specification for the Solstice programming language.

If you’re new to Solstice, I’d recommend starting the tutorial, at the installation page. If you’ve already installed Solstice, start at the Basics page.

+

Found a mistake? Report it at https://chookspace.com/solstice/docs

Docs generated by mdBook.

@@ -208,22 +209,6 @@ - - - +
@@ -216,22 +216,6 @@ - - - +
@@ -177,6 +177,7 @@

Introduction

Welcome to the Solstice documentation! Here we have a tutorial (starting here) and a specification for the Solstice programming language.

If you’re new to Solstice, I’d recommend starting the tutorial, at the installation page. If you’ve already installed Solstice, start at the Basics page.

+

Found a mistake? Report it at https://chookspace.com/solstice/docs

Docs generated by mdBook.

@@ -208,22 +209,6 @@ - - - +
@@ -211,22 +211,6 @@ - - - +
@@ -339,22 +339,6 @@ use "parser/parser" - - - +
@@ -216,22 +216,6 @@ - - - +
@@ -178,6 +178,7 @@

Introduction

Welcome to the Solstice documentation! Here we have a tutorial (starting here) and a specification for the Solstice programming language.

If you’re new to Solstice, I’d recommend starting the tutorial, at the installation page. If you’ve already installed Solstice, start at the Basics page.

+

Found a mistake? Report it at https://chookspace.com/solstice/docs

Docs generated by mdBook.

Installation

@@ -325,7 +326,7 @@ Args: -

We’ll look at types of values in the next part.

+

We’ll look at types of values soon.

Recalling Variables

Recall a variable’s content by using it’s name:

puts name
@@ -399,6 +400,72 @@ false
 

Solstice has three other types: fun, template, and object, but we’ll cover these in the Functions and Structures pages.

Functions

+

Defining Functions

+

In Solstice, functions are a way to organise and reuse code. Here’s an example function:

+
def add(int a, int b) int {
+    return a + b
+}
+
+

Here’s what each part is:

+
    +
  • def: Means “define”. Tells Solstice we are defining a function.
  • +
  • add: This is your function name! Choose something unique.
  • +
  • (int a, int b): These are the arguments your function takes. +
      +
    • Enclose your argument type and name pairs in brackets.
    • +
    • The first identifier should be a type (such as int, string, etc), the second should be an identifer
    • +
    • After each type-name pair, add a comma unless you’ve got no more arguments to define
    • +
    +
  • +
  • int: This is your return type
  • +
  • return a + b: This is where your code goes for the function
  • +
+

Calling Functions

+

Call a function in Solstice like this:

+
myFunction(a, b, c)
+
+

where:

+
    +
  • myFunction is the name of your function
  • +
  • (a, b, c) are the arguments you would like to pass to the function. +
      +
    • Enclose the arguments in parentheses (( ))
    • +
    • Each argument should be seperated by a comma
    • +
    • Solstice will type-check each argument to ensure it matches the function’s specified types
    • +
    +
  • +
+

Closures and Scoping

+

Each function has an attached closure, which is the state captured at runtime when the function is defined. All variables in the closure can be accessed inside the function body, however the closure cannot be modified (meaning all variables captured remain consistent across function runs).

+

This behaviour ensures that functions are not affected by global state, and will always have reliable, consistent behaviour.

+

Additionally, all defined arguments are avaliable in scope.

+
x = 10
+
+def myFunction() int {
+    // Here, x is avaliable, however if we modify it,
+    // our changes won't affect the external state, or
+    // the state of this function when it runs.
+    puts x
+    x = 5
+    return x
+}
+
+myFunction() // returns 5, prints 10
+myFunction() // returns 5, prints 10
+
+puts x // prints 10, x has not been modified by myFunction
+
+

The type of a function

+

If you’d like to accept a function as an argument, you need to specify it’s type signature. That can be done like this:

+
fun(int, string) bool
+
+

where:

+
    +
  • fun tells Solstice we’re writing a type signature for a function
  • +
  • (int, string) is the list of argument types (names are not needed), seperated by commas, surrounded by brackets
  • +
  • bool is the return type
  • +
+

making this type represent a function which takes an int and a string, and returns a bool.

Structures

@@ -430,6 +497,10 @@ new as sizeof pragma + +fun +template +object

Comments

@@ -1311,22 +1382,6 @@ use "parser/parser" - - - +
@@ -196,6 +196,10 @@ new as sizeof pragma + +fun +template +object @@ -233,22 +237,6 @@ pragma - - - +
@@ -240,22 +240,6 @@ - - - +
@@ -370,22 +370,6 @@ - - - +
@@ -211,22 +211,6 @@ - - - +
@@ -233,22 +233,6 @@ def add(int a, int b) int { - - - +
@@ -196,7 +196,7 @@ -

We’ll look at types of values in the next part.

+

We’ll look at types of values soon.

Recalling Variables

Recall a variable’s content by using it’s name:

puts name
@@ -238,22 +238,6 @@
         
         
 
-        
-        
 
 
         
         
-        
+        
     
     
     
@@ -272,22 +272,6 @@ - - - +
@@ -251,22 +251,6 @@ false - - - +
@@ -220,22 +220,6 @@ - - - +
@@ -240,22 +240,6 @@ - - - +
@@ -239,22 +239,6 @@ - -