.\" Made by website/plain/build.mjs from website/words/; change those files. .TH SG-INDEX 7 2026-11-28 "SG" "SG reference" .SH NAME sg\-index \- every name in SG .SH DESCRIPTION .SS "Keywords" .TP \fBalias\fR Gives a type a second name: the same type, which builds what it builds. .TP \fBalign\fR align(N) struct keeps every value of the type at a multiple of N bytes, wherever it is kept. .TP \fBas\fR Names a value lent for a block: a shared value opened, a locked value taken, an item a select receives. .TP \fBassert\fR Stops the program, or fails the test, when a condition is false. .TP \fBasync\fR Makes a function a light task, which may await and never holds its thread. .TP \fBatomic\fR A number or a bool that tasks change without a lock, one step at a time. .TP \fBawait\fR Waits for a task in an async function, without holding the thread, and gives what it returned. .TP \fBbreak\fR Leaves the loop it is in, or the loop it names, at once. .TP \fBchecked\fR shared checked T: a shared value changed through any owner, each borrow of it checked while the program runs. .TP \fBconst\fR A value fixed when the program is compiled. .TP \fBcontinue\fR Ends this round of the loop and goes on with the next. .TP \fBelse\fR The block that runs when the condition of an if is false. .TP \fBembed\fR embed("logo.gif"): the bytes of a file beside the source, read when the program is compiled and kept in it. .TP \fBenum\fR Declares a type whose value is one of several variants, each with values of its own. .TP \fBexport\fR Makes a function of SG that C calls by its name, or through a CFunc, a pointer to a function as C has it. .TP \fBextern\fR Declares the functions of a C library, or of a C file beside the program, to call inside unsafe. .TP \fBfor\fR Goes over the numbers of a range or the items of a collection, one round for each. .TP \fBif\fR Runs a block when a condition holds. .TP \fBin\fR Stands between the name and the items in a for. .TP \fBinterface\fR What a type can do; eight are built in and named after the colon, and a program cannot write its own yet. .TP \fBis\fR Tests whether a value is one variant, or null, and names what it carries. .TP \fBlock\fR A short block that alone touches a locked value; it never waits, so locks cannot deadlock. .TP \fBlocked\fR shared locked T: a value that tasks reach only inside a lock. .TP \fBmatch\fR Chooses by the shape of a value; every case must be covered. .TP \fBnew\fR Puts a value on the heap and gives the pointer that owns it. .TP \fBnot\fR Turns the test of is around: x is not P, whose names are seen where the test failed. .TP \fBor\fR Joins patterns: the arm, or the is, fits when one of them does. .TP \fBpacked\fR A struct with no padding between its fields and an alignment of 1, for a layout a file or a device gives. .TP \fBpublic\fR Shows a name to other modules; without it, a name stays inside its own module. .TP \fBraw\fR An address of C, which owns nothing, may be null, and is not checked by the compiler. .TP \fBread\fR Lends a value to be looked at, not changed. .TP \fBreadonly\fR Marks a field that is given when the value is built and never changed afterwards, nor anything behind it. .TP \fBref\fR Lends a value to be changed in place; the only borrow of it while it lasts. .TP \fBreturn\fR Ends the function, with its value. .TP \fBshare\fR Makes one more owner of a shared value, or an owner from a weak look. .TP \fBshared\fR shared T: a value on the heap with several owners, only read. .TP \fBstatic\fR A value made once, the first time the program uses it. .TP \fBstruct\fR Declares a type made of named fields, with the methods that work on them. .TP \fBtest\fR A block of checks written next to the code, which only sg test compiles and runs. .TP \fBtry\fR Opens a Result: its value, or the error handed to the caller. .TP \fBunion\fR A type whose fields all lie in the same bytes; it holds one of them at a time, read inside unsafe. .TP \fBunsafe\fR Marks code the checker cannot follow: raw memory, calls of C, the fields of a union. .TP \fBuse\fR Brings the public names of a module into a file, to be written without the module in front. .TP \fBvar\fR Declares a variable; its type comes from its value. .TP \fBweak\fR weak T: a look at a shared value that does not keep it alive; share asks for an owner. .TP \fBwhen\fR Adds a condition to an arm of a match, or makes a lock block wait until one holds. .TP \fBwhile\fR Repeats a block as long as a condition holds. .TP \fBwith\fR A copy of a struct with some fields changed: p with { x = 3 }. .SS "Primitive types" .TP \fBbool\fR true or false; the only type a condition can be. .TP \fBbyte\fR An integer of 8 bits, 0 to 255: one byte of a text, a file or a buffer. .TP \fBchar\fR One character of Unicode, in 32 bits; not a number. .TP \fBdouble\fR A fraction of 64 bits (IEEE 754); its arithmetic is the hardware's and never panics. .TP \fBfloat\fR A fraction of 32 bits (IEEE 754), about 7 digits; half the size of a double, for large arrays and for C. .TP \fBint\fR An integer of 32 bits, with a sign; a whole number is one when nothing else is asked for. .TP \fBlong\fR An integer of 64 bits, with a sign; for sums, sizes of files and time in milliseconds. .TP \fBnint\fR An integer with a sign, as wide as an address; every length, index and position is one. .TP \fBnuint\fR An integer without a sign, as wide as an address; C's size_t, and an address as a number. .TP \fBsbyte\fR An integer of 8 bits, with a sign, from -128 to 127: a small step, a reading, a signed byte of a file. .TP \fBshort\fR An integer of 16 bits, with a sign, from -32 768 to 32 767: a sample of sound, a field of two bytes. .TP \fBstring\fR Text in UTF-8 that owns its memory; read string is a borrow of it. .TP \fBuint\fR An integer of 32 bits without a sign, 0 to 4 294 967 295: for bits, masks, colors and hashes. .TP \fBulong\fR An integer of 64 bits without a sign, 0 to 18 446 744 073 709 551 615: for hashes, random numbers and sets of 64 bits. .TP \fBushort\fR An integer of 16 bits without a sign, from 0 to 65 535: a port, a field of a packet, a counter that wraps. .TP \fBvoid\fR The return type of a function that gives nothing back. .SS "Values with a name" .TP \fBfalse\fR The bool that is not true; what a comparison gives when it does not hold, and the zero value of a bool. .TP \fBnull\fR No value; only a type written T? may hold it, and it is tested with is null. .TP \fBthis\fR The value a method was called on; read this looks, ref this changes, this alone takes it. .TP \fBtrue\fR The bool that is not false; what a comparison gives when it holds. .SS "Signs" .TP \fB$"{x}"\fR Text with values written into it, checked when the program is compiled; .toString() makes it a string. .TP \fBa..b\fR A range: the numbers from a up to b, without b; in a pattern, a..=b takes b too. .TP \fBc ? a : b\fR A value picked by a condition: a when c is true, b when it is false; only that arm runs. .TP \fBT?\fR A T that may be null; it is tested before it is used as a T. .TP \fBT[]\fR A slice: a window onto items that something else owns. .TP \fBT*\fR A pointer that owns a value on the heap. .TP \fBx ?? y\fR The value of x, or y when x is null or an error. .TP \fBx?.y\fR A field or a method of x, or null when x is null. .TP \fBxs[^1]\fR An index counted from the end: xs[^1] is the last item, xs[^n] is xs[xs.length() - n]. .SS "Types of the library" .TP \fBBase64\fR A type of the library, in Hex, Base64 and percent. .TP \fBCancellationSource\fR A type of the library, in Tasks. .TP \fBChannel\fR A type of the library, in Tasks. .TP \fBClock\fR A type of the library, in Time. .TP \fBCommand\fR A type of the library, in Programs and the system. .TP \fBDateError\fR A type of the library, in Time. .TP \fBDateTime\fR A type of the library, in Time. .TP \fBDateTimeOffset\fR A type of the library, in Time. .TP \fBDecodeError\fR A type of the library, in Hex, Base64 and percent. .TP \fBDirectory\fR A type of the library, in Files and folders. .TP \fBDuration\fR A type of the library, in Time. .TP \fBEnvironment\fR A type of the library, in Programs and the system. .TP \fBExitStatus\fR A type of the library, in Programs and the system. .TP \fBHashMap\fR A type of the library, in Collections. .TP \fBHashSet\fR A type of the library, in Collections. .TP \fBHex\fR A type of the library, in Hex, Base64 and percent. .TP \fBHttpConnection\fR A type of the library, in HTTP. .TP \fBHttpOptions\fR A type of the library, in HTTP. .TP \fBHttpRequest\fR A type of the library, in HTTP. .TP \fBInstant\fR A type of the library, in Time. .TP \fBIoError\fR A type of the library, in Files and folders. .TP \fBList\fR A list of items that grows, kept in one block of memory. .TP \fBPath\fR A type of the library, in Files and folders. .TP \fBPercent\fR A type of the library, in Hex, Base64 and percent. .TP \fBPipeline\fR A type of the library, in Programs and the system. .TP \fBProcess\fR A type of the library, in Programs and the system. .TP \fBRandom\fR A type of the library, in Random numbers. .TP \fBSecureRandom\fR A type of the library, in Random numbers. .TP \fBSignals\fR A type of the library, in Programs and the system. .TP \fBStdin\fR A type of the library, in Files and folders. .TP \fBStreamReader\fR A type of the library, in Files and folders. .TP \fBStreamWriter\fR A type of the library, in Files and folders. .TP \fBTask\fR A type of the library, in Tasks. .TP \fBTaskGroup\fR A type of the library, in Tasks. .SS "Modules of the library" .TP \fBCollections\fR Arrays, slices, List, HashMap and HashSet, with all their methods. .TP \fBCompression\fR Deflate, Zlib and Gzip, both ways, at once or as a stream; zlib's bytes at every level, and a limit on what is opened. .TP \fBCRC\-32 and Adler\-32\fR Crc32, the checksum of gzip, PNG and ZIP, and Adler32, the checksum of zlib, at once or piece by piece. .TP \fBFiles and folders\fR File, StreamReader and StreamWriter, the standard streams, Directory and watching a folder, Path, FileInfo and IoError. .TP \fBHex, Base64 and percent\fR Hex, Base64 and the percent-encoding of URLs, bytes written as text and read back, strictly. .TP \fBHTTP\fR HttpConnection, the server's side of HTTP/1.1, a request pulled and answered at a time, read where it lies, with the limits a server on the internet needs on from the start. .TP \fBJSON\fR Json, JsonValue and JsonObject, JSON read strictly into values, looked into, built, changed and written back. .TP \fBLog\fR Log and LogLevel, lines of a log written to the standard error, a level that is off costing almost nothing, and a message never read for anything in it. .TP \fBNumbers\fR The integer and fractional types, their constants, conversions, arithmetic that cannot panic, bits, math and parsing. .TP \fBPrograms and the system\fR Command, Process, Pipeline and ExitStatus to run other programs, jobs and the terminal, a terminal of its own and a raw one, Environment, and Signals. .TP \fBRandom numbers\fR Random, a fast generator that a seed sets, and SecureRandom, the random bytes of the system. .TP \fBRegular expressions\fR Regex, Match and Captures, patterns matched in a time that grows with the text and no more, and a pattern written in the program checked when it is compiled. .TP \fBSHA\-256 and HMAC\fR Sha256, Hmac.sha256 and Bytes.equalInConstantTime, the hash and the keyed tag of the standards. .TP \fBTasks\fR Task, TaskGroup, Channel and Sender, shared locked values, atomics and cancellation, with their signatures. .TP \fBText\fR string, read string and char, with every method they have. .TP \fBThe command line\fR CommandLine and Arguments, the flags, options and words a program takes, read the GNU way. .TP \fBTime\fR Duration, Instant, DateTime and DateTimeOffset, and the clocks under them. .TP \fBZip archives\fR ZipReader and ZipWriter, archives read and written as Go reads and writes them, checked for Zip Slip and bombs before anything is read. .SS "Commands" .TP \fBsg\fR Runs a program in the interpreter, from a file or a folder; the words after it are the program's own. .TP \fBsg add\fR Adds a package to sg.project and fetches it; with sg update, sg remove and sg lock, which keep sg.lock. .TP \fBsg build\fR Compiles through C: a program, the program of its tests, a library C calls, or an object without an operating system. .TP \fBsg emit\-c\fR Prints the C that sg build compiles, for reading, for a sanitizer, or for a build of your own. .TP \fBsg help\fR Prints the page of a word, a sign or a command of SG in the terminal, from sg itself, with no network. .TP \fBsg lsp\fR The language server an editor starts: the first error as you type, and fixes applied with one click. .TP \fBsg test\fR Runs the tests of a file, or of every module in a folder, in the interpreter or compiled. .SH "SEE ALSO" .BR sg-add (1), .BR sg-build (1), .BR sg-emit-c (1), .BR sg-help (1), .BR sg-lsp (1), .BR sg-test (1), .BR sg (1), .BR sg-alias (7), .BR sg-align (7), .BR sg-as (7), .BR sg-assert (7), .BR sg-async (7), .BR sg-atomic (7), .BR sg-await (7), .BR sg-bool (7), .BR sg-break (7), .BR sg-byte (7), .BR sg-char (7), .BR sg-checked (7), .BR sg-conditional (7), .BR sg-const (7), .BR sg-continue (7), .BR sg-double (7), .BR sg-else (7), .BR sg-embed (7), .BR sg-enum (7), .BR sg-export (7), .BR sg-extern (7), .BR sg-false (7), .BR sg-float (7), .BR sg-for (7), .BR sg-if (7), .BR sg-in (7), .BR sg-index-from-end (7), .BR sg-int (7), .BR sg-interface (7), .BR sg-interpolation (7), .BR sg-is (7), .BR sg-list (7), .BR sg-lock (7), .BR sg-locked (7), .BR sg-long (7), .BR sg-match (7), .BR sg-new (7), .BR sg-nint (7), .BR sg-not (7), .BR sg-nuint (7), .BR sg-null-coalescing (7), .BR sg-null-conditional (7), .BR sg-null (7), .BR sg-nullable (7), .BR sg-or (7), .BR sg-packed (7), .BR sg-pointer (7), .BR sg-public (7), .BR sg-range (7), .BR sg-raw (7), .BR sg-read (7), .BR sg-readonly (7), .BR sg-ref (7), .BR sg-return (7), .BR sg-sbyte (7), .BR sg-share (7), .BR sg-shared (7), .BR sg-short (7), .BR sg-slice (7), .BR sg-static (7), .BR sg-string (7), .BR sg-struct (7), .BR sg-test (7), .BR sg-this (7), .BR sg-true (7), .BR sg-try (7), .BR sg-uint (7), .BR sg-ulong (7), .BR sg-union (7), .BR sg-unsafe (7), .BR sg-use (7), .BR sg-ushort (7), .BR sg-var (7), .BR sg-void (7), .BR sg-weak (7), .BR sg-when (7), .BR sg-while (7), .BR sg-with (7)