Standard Library

The Karkain standard library is a set of .kark modules importable from any program through the normal toolchain (import std.string and friends) on both engines — the Go front end and the self-hosted kcc engine.

Implemented and importable modules

Implemented — these modules are importable, tested, and byte-identical on both engines (Phase 132 API Freeze):

Module

Purpose

Functions

std.string

String manipulation utilities

27

std.collections

Array and map helpers

24

std.io

File and stream I/O

11

std.encoding

Hex, Base64 and UTF-8 codecs

7

std.crypto

SHA-256 / SHA-512 digests

2

std.testing

Assertion and check helpers

9

std.numerics

Numerical/ML foundation (vector/matrix/tensor ops)

40

std.net

TCP networking (Address/Endpoint/Connection/Listener)

10

std.http

HTTP/1.1 client/server building blocks

20

std.db

Backend-neutral database layer (SQL subset)

20

stdlib/ also contains std.core, std.math, std.system, std.gpu and std.async, but these are not importable: they use non-canonical syntax (type annotations, import "libc" blocks, tuples, Option/Result) and have no runtime builtin backing. They sit behind the Phase 109 standard-library boundary. See core, math and not-implemented.

Modules that do not exist in the repository at all — std.memory, std.filesystem, std.process, std.os, std.time, std.concurrency, std.diagnostics — are tracked in not-implemented.

Invariants shared by every implemented module

  • Every module is written in canonical Karkain (untyped parameters, no type annotations) and produces byte-identical behavior on the Go engine and the self-hosted kcc engine.

  • Module functions are part of the framework API, so the public privacy rule does not apply to stdlib; every function may be called unqualified or namespace-qualified (str_to_upper(x) == std.string.str_to_upper(x)).

  • The karkain test driver does not yet support import statements (Phase 96 boundary); the modules are validated through karkain run.