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.
Use the existing builtins
Section titled “Use the existing builtins”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:
hy compile example.hy -o examplechmod +x example./exampleNative 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.
API families
Section titled “API families”| 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.
Library design
Section titled “Library design”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.