Standard Library
The standard library is the set of tools that come with Emerald, for jobs most programs end up needing: reading and writing files, working with dates, matching patterns in text, talking to the web. Like the built-ins, they need no import; every one is already there when a program starts.
- Math, Program, and Random:
Mathfor constants, trigonometry, logarithms, and powers;Programfor the running program’s own command-line arguments, and pausing it; andRandomfor seeded random numbers. - Files:
FileandDirectoryto read, write, and list;Pathfor working with file names;FileHandleandFileWriterfor streaming; andFileError. - Dates and Times:
Date,Time,DateTime,Instant,Duration,TimeZone,Weekday,Stopwatch, andDateTimeError, with advice on which to use. - Regular Expressions:
RegexandRegex.Match, to find, replace, and split text by pattern, andRegexError. - Console:
ConsoleandConsole.Color, for styled output, tables, and prompts. - JSON:
Json,Json.Kind, andJsonError, to read and write JSON text. - CSV:
CsvandCsvError, to read and write comma-separated tables. - Base64 and Digest:
Base64to write binary data as text, andDigestfor SHA-256 and HMAC-SHA256 fingerprints. Their errors are anEncodingError. - HTTP:
HttpandHttp.Response, to make web requests, andHttpError. - Tasks and Channels:
Tasks,Task,TaskGroup, andChannel, to let several pieces of work wait at once and pass values between them, withCancelledErrorandDeadlockError.
A name that a program declares itself always wins over one of these, so a program with its own
File still works. The library’s version stays reachable as Emerald.File; see
Projects and Namespaces.