🏆 Self-Hosted Standard Library!
The Ovie standard library is implemented using the self-hosted Ovie compiler, demonstrating the language's capability to build complex, production-ready software.
Overview
The Ovie standard library provides a comprehensive set of modules for common programming tasks. All modules are designed with simplicity, safety, and performance in mind, following Ovie's philosophy of accessible programming.
💡 Quick Start
Import any standard library module using the use statement:
// Import entire module
use std/io
// Import specific functions
use std/math { sqrt, pow, pi }
// Import with alias
use std/fs as file_system
std/core
Core types, functions, and fundamental operations that form the foundation of Ovie programming.
Result<T>
Type for handling operations that can succeed or fail.
ok(value) | error(message)
Option<T>
Type for values that may or may not exist.
some(value) | none()
to_string(value) -> String
Convert any value to its string representation.
to_string(42) // "42"
to_number(str) -> Result<Number>
Parse a string into a number.
to_number("3.14") // ok(3.14)
type_of(value) -> String
Get the type name of a value.
type_of(42) // "Number"
clone(value) -> T
Create a deep copy of a value.
mut copy = clone(original)
std/io
Input/output operations and stream handling for console and file I/O.
seeAm(message)
Print a message to stdout (Ovie's signature function).
seeAm "Hello, World!"
print(message)
Print without newline.
print "Enter name: "
println(message)
Print with newline.
println "Debug info"
read_line() -> String
Read a line from stdin.
mut input = read_line()
eprint(message)
Print to stderr.
eprint "Error occurred"
flush()
Flush output buffers.
flush()
std/fs
File system operations and path manipulation for working with files and directories.
read_file(path) -> Result<String>
Read entire file contents as string.
mut content = read_file("data.txt")
write_file(path, content) -> Result
Write string to file.
write_file("output.txt", data)
append_file(path, content) -> Result
Append string to file.
append_file("log.txt", entry)
exists(path) -> Boolean
Check if file or directory exists.
if exists("config.toml") { ... }
create_dir(path) -> Result
Create a directory.
create_dir("output")
remove_file(path) -> Result
Delete a file.
remove_file("temp.txt")
list_dir(path) -> Result<Array>
List directory contents.
mut files = list_dir(".")
is_file(path) -> Boolean
Check if path is a file.
if is_file(path) { ... }
std/time
Time, duration, and date handling for temporal operations.
now() -> Timestamp
Get current timestamp.
mut current = now()
duration(seconds) -> Duration
Create duration from seconds.
mut timeout = duration(30)
sleep(duration)
Pause execution for duration.
sleep(duration(1))
format_time(timestamp, format) -> String
Format timestamp as string.
format_time(now(), "%Y-%m-%d")
parse_time(str, format) -> Result<Timestamp>
Parse string into timestamp.
parse_time("2026-01-30", "%Y-%m-%d")
elapsed(start) -> Duration
Time elapsed since timestamp.
mut time_taken = elapsed(start)
std/cli
Command-line interface utilities for building CLI applications.
args() -> Array<String>
Get command-line arguments.
mut arguments = args()
env_var(name) -> Option<String>
Get environment variable.
mut home = env_var("HOME")
exit(code)
Exit program with code.
exit(0)
parse_args(args, spec) -> Result<ParsedArgs>
Parse command-line arguments.
mut parsed = parse_args(args(), spec)
prompt(message) -> String
Prompt user for input.
mut name = prompt("Enter name: ")
confirm(message) -> Boolean
Ask for yes/no confirmation.
if confirm("Continue?") { ... }
std/testing
Unit and property-based testing framework for reliable software development.
assert(condition, message)
Assert that condition is true.
assert(result == 42, "Wrong result")
assert_equal(actual, expected)
Assert values are equal.
assert_equal(add(2, 3), 5)
test(name, test_fn)
Define a unit test.
test "addition" { assert_equal(1+1, 2) }
property(name, property_fn)
Define a property-based test.
property "commutative" { ... }
benchmark(name, bench_fn)
Define a benchmark test.
benchmark "sort" { sort(data) }
mock(object) -> Mock
Create a mock object for testing.
mut mock_db = mock(database)
std/log
Structured logging and debugging utilities for application monitoring.
info(message)
Log informational message.
info("Application started")
warn(message)
Log warning message.
warn("Deprecated function used")
error(message)
Log error message.
error("Database connection failed")
debug(message)
Log debug message.
debug("Variable value: " + value)
set_level(level)
Set minimum log level.
set_level("INFO")
log_to_file(path)
Direct logs to file.
log_to_file("app.log")
std/math
Mathematical operations and constants for numerical computing.
abs(x) -> Number
Absolute value of a number.
abs(-5) // 5
sqrt(x) -> Number
Square root of a number.
sqrt(16) // 4
pow(base, exp) -> Number
Raise base to power of exponent.
pow(2, 3) // 8
pi
Mathematical constant π.
mut circumference = 2 * pi * radius
sin(x) -> Number
Sine of angle in radians.
sin(pi / 2) // 1
max(a, b) -> Number
Maximum of two numbers.
max(10, 5) // 10
min(a, b) -> Number
Minimum of two numbers.
min(10, 5) // 5
round(x) -> Number
Round to nearest integer.
round(3.7) // 4
Importing Modules
The Ovie module system makes it easy to use standard library functionality:
// Import entire modules
use std/io
use std/fs
use std/math
// Use functions from imported modules
seeAm "Hello, World!"
mut content = read_file("data.txt")
mut result = sqrt(16)
// Import specific functions
use std/math { sqrt, pow, pi, sin, cos }
use std/time { now, duration, sleep }
// Use imported functions directly
mut hypotenuse = sqrt(pow(3, 2) + pow(4, 2))
sleep(duration(1))
// Import with aliases
use std/fs as file_system
use std/cli as command_line
// Use aliased modules
mut files = file_system.list_dir(".")
mut args = command_line.args()
🚀 Complete Example
// Complete program using multiple standard library modules
use std/io
use std/fs
use std/time { now, format_time }
use std/cli { args }
use std/log { info, error }
fn main() {
// Get command line arguments
mut arguments = args()
if array_length(arguments) < 2 {
error("Usage: program <filename>")
return
}
mut filename = array_get(arguments, 1)
info("Processing file: " + filename)
// Read file
mut content_result = read_file(filename)
if is_error(content_result) {
error("Failed to read file: " + error_message(content_result))
return
}
mut content = unwrap(content_result)
mut timestamp = format_time(now(), "%Y-%m-%d %H:%M:%S")
seeAm "File: " + filename
seeAm "Size: " + array_length(content) + " characters"
seeAm "Processed at: " + timestamp
info("Processing completed successfully")
}
🏆 Production Ready
The Ovie standard library is battle-tested and production-ready. All modules are implemented using the self-hosted Ovie compiler, proving the language's capability to build robust, reliable software.
Standard Library v1.0.0 - Self-hosted since January 30, 2026 🎉
For examples using these modules, visit our Examples Gallery