Standard Library Overview
The cnegative standard library is intentionally small.
That is good for beginners: you can learn it without feeling like you need a huge ecosystem map first.
How to use this section
If you are new, do not try to read every module in one pass.
Read in this order:
That order goes from “ordinary small programs” to “host/platform experiments”.
Current modules
std.mathfor small integer helpersstd.bytesfor growable byte buffersstd.ipcfor text-first child-process IPCstd.linesfor growable line storagestd.stringsfor string helpersstd.textfor growable text buildersstd.parsefor turning text into typed valuesstd.fsfor file and directory workstd.iofor simple terminal input and outputstd.termfor low-level terminal control, capability queries, timed key/mouse/resize/paste events, styles, and buffer diff renderingstd.envfor environment variablesstd.pathfor path manipulationstd.timefor basic timingstd.netfor blocking IPv4 TCP/UDP plus a few text helpersstd.processfor target/process helpersstd.x11for an experimental Linux-only real-window stress-test path
not a giant runtime
This is not a full batteries-included platform yet. The current stdlib is the first practical slice.
experimental host module
std.x11 is intentionally tiny and Linux-only right now. It exists to stress-test real host window integration before a broader interop story exists.
What is owned and what must be freed?
Some stdlib functions return owned runtime strings. Those should be released with free.
Current owned-string stdlib producers include:
std.process.platform(...)std.process.arch(...)std.ipc.stdout_read(...)on successstd.ipc.stdout_read_line(...)on successstd.ipc.request_line(...)on successstd.ipc.stderr_read(...)on successstd.ipc.stderr_read_line(...)on successstd.strings.copy(...)std.strings.concat(...)std.text.build(...)on successstd.fs.read_text(...)on successstd.fs.cwd(...)on successstd.io.read_line()std.term.read_paste(...)on successstd.term.term_name(...)on successstd.env.get(...)on successstd.path.join(...)std.path.file_name(...)std.path.stem(...)std.path.extension(...)std.path.parent(...)on successstd.net.join_host_port(...)std.net.recv(...)on success- the
hostanddatafields from successfulstd.net.udp_recv_from(...)
Beginner recommendation
If you are writing your first few programs, start with:
std.iostd.stringsstd.fsstd.parse
You can ignore std.term, std.net, std.ipc, and std.x11 until the basics feel comfortable.
One extra repo-level note: std.term is the foundation for future higher-level TUI libraries. std.lines is one of the data-layer pieces that can sit under editor-style apps built on top of it.
Tiny example
import std.fs as fs;
import std.io as io;
fn:int main() {
let ok:result bool = fs.write_text("build/demo.txt", "42");
if ok.ok == false {
return 1;
}
io.write_line("done");
return 0;
}