Skip to content

Hydrogen standard library

Development reference from Hylang-Stdlib. Commands and source paths on this page are relative to that repository checkout. For current task status, use the development project.

This repository contains the standard-library design plan. It does not yet contain installable .hyproj library implementations. Existing System.* APIs are built into the Hydrogen compiler runtimes.

For available APIs and exact compiler-route support, use the builtin reference and current release guide.

No separate package is required for console output, file text/byte I/O, and integer parsing:

public class Program {
public static int Main() {
System.IO.File.WriteAllText("message.txt", "Hello, Hydrogen!\n");
System.Console.Write(System.IO.File.ReadAllText("message.txt"));
System.Console.WriteLine(System.Convert.ToInt32("42"));
return 0;
}
}

This complete program creates/replaces message.txt in the process working directory. Save it as example.hy and compile it with the released Linux x86-64 compiler:

Terminal window
hy compile example.hy -o example
chmod +x example
./example

Native names should be fully qualified. Strings are byte-based, file reads require seekable files in the native runtime, and failed native I/O terminates with an error.

Family Available implementation
System.Console.Write/WriteLine Native, AUEX, and SDK
System.Console.ReadLine AUEX
System.IO.File text/existence Native, AUEX, and SDK; AUEX text is limited to 255 bytes
System.IO.File byte arrays Native and SDK
System.Convert.ToInt32 Native, AUEX, and SDK; returns int
System.Runtime.GC.Collect Native source and development SDK C output; SDK interpreter treats it as a no-op
System.Runtime.GC.GetAllocatedBytes Native source only
System.Collections.List<T> SDK builtin only
System.Runtime.Buffer, Memory, BinaryPrimitives SDK builtins only
System.Testing.Assert SDK builtin only

The SDK supplies broader generic/unsafe/runtime features than the self-hosted native compiler. Builtin recognition during native checking does not guarantee emission support.

The standard-library design plan proposes reusable layers for core types, memory, runtime, text, I/O, and Australis-specific services. Proposed Hydrogen.*/Australis.* package names and example APIs in that document are future designs, not imports currently supplied by this repository. Australis’s checked AUEX APIs and small native AUN1 loader are OS/compiler features, not packages from this repository.