Eve System Library
The Standard Library is what every program has without an import: the built-in functions and the standard streams. The System Library is the set of modules that connect a program to the machine around it: the console, the file system, the clock, the shell and the network. A module of the system library is imported with
from … use, like any other module, from $EVE_LIB.
Status: only
io and exception are drafted for Eve 0.1 (evevm/lib/). The other modules are planned for the data client (level 3) and later; their names and members are a design, waiting for the author's review (plan/decision_level3.md, Q-024).The modules
| Module | What it holds | Status | Page |
|---|---|---|---|
io | standard streams: write, print, read, error, warning, log_err, log_wrn | 0.1 draft | Standard Library |
exception | the class Error, raise, expect, assert, the error and warning codes | 0.1 draft | Exceptions |
| system variables | $EVE_LIB, $EVE_OUT, $HOME and every environment variable as $NAME | 0.1 | EVE VM |
call (shell) | run an operating system command, capture its output | 0.1 design | Shell Commands |
fs | files, folders and paths in one module: read and write text and bytes, lines as a stream, list a folder, glob; the operator / joins paths | designed, level 5 | Files and ETL |
time | the clock, Instant, DateTime with a zone, sleeping | designed, level 5 | Date and Time |
secret | Secret: tokens and passwords that never appear in logs or in code | designed, level 5 | Databases |
os | run(command, arguments, cwd: dir) without a shell, gives the exit code and the output | designed, level 5 | Shell Commands |
csv, json, dat | read and write files as streams of rows or nodes, typed by a record class, in Unicode; .gz files are read on the fly | designed, level 5 | Files and ETL |
task | channels and the worker pool of parallel aspects | planned, level 4 | Concurrency |
database | connections, Record and Table, tracked records, transactions per job, direct SQL, checkpoints | designed, level 5 | Databases |
http | the client in level 5 (get!, post!, request!); serving in level 6 | client designed, level 5 | Networking |
Rules of the system library
- Written in Eve. A module is Eve code. Only the few primitives that need the machine are
externaldeclarations, implemented by the virtual machine in Zig (see EVE VM); - Errors are values of the language. A module raises the errors of the
exceptionmodule, so onerecoverregion handles them all; - Thread safety is declared by the compiler. A function of a module is thread safe only if it keeps no plain shared variable; a
concurrent aspectcan call it only then (see Thread safety); - Documented from the code.
eve --docbuilds the reference of a module from its**comments and signatures.
Example
The io module is always available. The example below reads a name and writes a line; it uses only the functions of the standard streams.
# ask a name and greet
driver greeting is
process main is
new name := "";
read(name, "name: ");
print "Hello,", name;
return;
end greeting;
Read next: EVE VM