Global namespace
The declarations that every CShift program sees without a using: the interfaces the language itself relies on
(using with IDisposable, sorting with IComparable, equality and hashing for collections) and
sqrt.
Tuples: (int, string) is the type Tuple2<int, string>, (1, "a") a value of it. The language writes and
reads them with its own syntax (docs/language/tuples.md); these are the structs behind it.
The types, functions and namespaces that the compiler provides itself: string, the numbers (int32, double,
…), bool, char, arrays (Array), slices (Slice, ReadOnlySlice, StringSlice), Fixed, Optional,
Error, Console, Environment, Memory, Thread, SharedPtr, Enum, Action and Func. They need no
using.
| Type | Description |
|---|---|
Tuple2<T1, |
A tuple of 2 values: the type (T1, T2), made by (a1, a2). |
Tuple3<T1, |
A tuple of 3 values: the type (T1, T2, T3), made by (a1, a2, a3). |
Tuple4<T1, |
A tuple of 4 values: the type (T1, T2, T3, T4), made by (a1, a2, a3, a4). |
Tuple5<T1, |
A tuple of 5 values: the type (T1, T2, T3, T4, T5), made by (a1, a2, a3, a4, a5). |
Tuple6<T1, |
A tuple of 6 values: the type (T1, T2, T3, T4, T5, T6), made by (a1, a2, a3, a4, a5, a6). |
Tuple7<T1, |
A tuple of 7 values: the type (T1, T2, T3, T4, T5, T6, T7), made by (a1, a2, a3, a4, a5, a6, a7). |
IDisposable |
A resource that has to be released: `using (var f = …) { … |
IComparable<T> |
Values that have an order: List<T>.Sort and the comparison of keys use it. |
IEquatable<T> |
Equality for generic containers (List<T>.IndexOf, List<T>.Contains, the keys of a Dictionary). |
IHashable |
Hash codes for the keys of a Dictionary and the values of a HashSet. |
Functions
Section titled “Functions”| Name | Description |
|---|---|
sqrt |
The square root of x (the C library’s sqrt). |
extern "C" double sqrt(double x)The square root of x (the C library’s sqrt).
Returns NaN for a negative x.
float sqrt(float x)The square root of x as a float (the C library’s sqrtf).
Returns NaN for a negative x.