virgil

Virgil Libraries

Virgil is designed as a lightweight programming language with a clear separation between what is in the language versus what is in the libraries. For example, in Virgil, the language provides constructs to define classes, enums, or algebraic data types, but there are no built-in ones. The only built-in types are the primitives (int, bool, void, float, etc), and the type constructors (Array, functions, and tuples). The string type is simply an alias for Array<byte>.

This is in contrast to languages like Java and C#, where many language concepts rely on support in the standard library and thus refer to certain built-in classes.

Instead, all classes, enums, and algebraic data types in Virgil are in fact, user-defined types.

Exploring lib/util

Nevertheless, Virgil has a collection of useful utilities that are included in this repository, since many common tasks, like formatting strings, dealing with IO, building data structures, etc, recur often. Generally, these utilities are not designed to meet all possible use cases, so they don’t have every imaginable utility method and aren’t designed to guard against every possible form of misuse. They aren’t “armored vehicles”, but more like kitchen knives–they have a sharp end and a handle.

In lib/util we can find:

Demoing lib/util

Reading the source code of libraries is long and tedious, even when documented well. While it may help to familiarize yourself with how Virgil code is written, libraries don’t tell you how they are supposed to be used. For this, how about a demo?

Take a look at a demo that has various sections on each of the utilities above. The demo teaches you, on a class-by-class basis, how to use each utility.