Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Generics

Generics let you write reusable code for multiple types.

public struct Pair<T> {
public:
    left: T;
    right: T;
}

fun pick_first<T>(a: T, _b: T) -> T {
    return a;
}

Monomorphization happens in the compiler pipeline before type checking and lowering to C.