Learn

Install SG, take the tour, and read the book.

Install
Build the sg command from source, and set up an editor.
A tour of SG
The language in a dozen short programs, each of which runs.

The SG book

Getting started
Install sg, run a first program, build it, test it, and read what it says when something goes wrong.
Values
Variables, the number types and their sizes, conversions, overflow, characters, constants and bits.
Text
Owned text and text that is only looked at, literals, formatting, the common methods, building text, UTF-8 and parsing numbers.
Functions
Declaring functions, parameters by value, read and ref, returning, recursion, functions as values, and using what a call gives.
Structs and enums
Your own types, the methods on them, the built-in interfaces they take, and the match that looks inside them.
Null and errors
Values that may be missing, errors as values with Result and try, and the panics that stop a program.
Ownership and borrowing
How SG frees every value at the right moment without a garbage collector, and the rules the compiler checks to keep that safe.
Collections
Arrays, slices, lists, hash maps and hash sets, the loops that go over them, and what the compiler refuses while they do.
Modules
A folder is a module; `use`, `public`, `readonly` and a folder `internal` say what other modules see; a program can be a file or a whole folder, and `sg.project` names its packages.
Tasks, locks and channels
Running work at the same time without data races, with tasks, locked values, channels, async functions and atomic values.
Working with C
Calling the functions of C, passing C's types, being called by C, and building a library of SG that a program of C links.
Unsafe code
What `unsafe` marks, how raw memory is reached, what the interpreter and the sanitizers check there, and why the rest of a program stays safe.
Testing
Tests written next to the code with `test` and `assert`, run by `sg test` in the interpreter or compiled, with leaks reported.
Building programs
Debug and release builds, the C that SG writes, libraries, the three systems, machines without an operating system, and the editor.
Debugging a program
A compiled program in gdb, lldb or the debugger of Windows, on the lines of its own files.
SG for Rust programmers
What a Rust programmer writes, and what SG writes for it.