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

ModuleWhat it holdsStatusPage
iostandard streams: write, print, read, error, warning, log_err, log_wrn0.1 draftStandard Library
exceptionthe class Error, raise, expect, assert, the error and warning codes0.1 draftExceptions
system variables$EVE_LIB, $EVE_OUT, $HOME and every environment variable as $NAME0.1EVE VM
call (shell)run an operating system command, capture its output0.1 designShell Commands
fsfiles, folders and paths in one module: read and write text and bytes, lines as a stream, list a folder, glob; the operator / joins pathsdesigned, level 5Files and ETL
timethe clock, Instant, DateTime with a zone, sleepingdesigned, level 5Date and Time
secretSecret: tokens and passwords that never appear in logs or in codedesigned, level 5Databases
osrun(command, arguments, cwd: dir) without a shell, gives the exit code and the outputdesigned, level 5Shell Commands
csv, json, datread and write files as streams of rows or nodes, typed by a record class, in Unicode; .gz files are read on the flydesigned, level 5Files and ETL
taskchannels and the worker pool of parallel aspectsplanned, level 4Concurrency
databaseconnections, Record and Table, tracked records, transactions per job, direct SQL, checkpointsdesigned, level 5Databases
httpthe client in level 5 (get!, post!, request!); serving in level 6client designed, level 5Networking

Rules of the system library

  • Written in Eve. A module is Eve code. Only the few primitives that need the machine are external declarations, implemented by the virtual machine in Zig (see EVE VM);
  • Errors are values of the language. A module raises the errors of the exception module, so one recover region 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 aspect can call it only then (see Thread safety);
  • Documented from the code. eve --doc builds 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